Skip to content

Lev/agent control integration#1

Draft
lan17 wants to merge 25 commits intomainfrom
lev/agent-control-integration
Draft

Lev/agent control integration#1
lan17 wants to merge 25 commits intomainfrom
lev/agent-control-integration

Conversation

@lan17
Copy link
Owner

@lan17 lan17 commented Feb 19, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

…r gateway token

The message tool and other gateway-dependent tools called from the sandbox
fail with 'pairing required' because resolveGatewayOptions() only reads the
explicit gatewayToken param and never falls back to OPENCLAW_GATEWAY_TOKEN
env var or gateway.auth.token from config.

This mirrors the fallback chain in callGateway (src/gateway/call.ts):
explicit param → OPENCLAW_GATEWAY_TOKEN → CLAWDBOT_GATEWAY_TOKEN → config

Fixes openclaw#21478
…iring check

operatorScopeSatisfied() only treated operator.admin as a superset of
operator.read, but not operator.write, operator.approvals, or
operator.pairing. This caused agent tool calls (e.g. message send)
to fail with 'pairing required' because the tool requests
operator.write scope, and the already-paired device only had
operator.admin — which should be sufficient.

This was inconsistent with authorizeOperatorScopesForMethod() in
method-scopes.ts, which correctly treats operator.admin as god-mode.

Fixes the 'gateway closed (1008): pairing required' error when the
agent sandbox tries to send messages via the gateway.
# Conflicts:
#	src/agents/pi-embedded-runner/run/attempt.test.ts
#	src/agents/pi-embedded-runner/run/attempt.ts
lan17 added a commit to agentcontrol/agent-control that referenced this pull request Feb 23, 2026
Tested in OpenClaw integration PR:
lan17/openclaw#1

## Summary
This PR delivers the TypeScript SDK in this repo from scaffold to
production-ready client, then layers deterministic client-surface naming
improvements on top.

## What’s Included
- Added and wired `sdks/typescript/` package structure,
build/test/lint/typecheck flow, and npm publish workflow.
- Added Speakeasy generation against committed `server/openapi.json`
with committed generated SDK sources.
- Wired `AgentControlClient` to generated Speakeasy runtime and exposed
endpoint namespaces (`agents`, `controls`, `evaluation`,
`evaluatorConfigs`, `evaluators`, `observability`, `policies`,
`system`).
- Added client wiring tests (URL/query/body/auth headers and pre-init
guard behavior).
- Added monorepo TypeScript example app (`examples/typescript_sdk`) that
demonstrates consuming `agent-control` via npm-compatible setup.

## Deterministic Method Naming (follow-up in this PR)
- Replaced ad-hoc method overrides with a deterministic rule-generated
overlay.
- Added generator:
`sdks/typescript/scripts/generate-method-names-overlay.py`.
- Updated generation flow so `generate-sdk.sh` regenerates
`overlays/method-names.overlay.yaml` from OpenAPI before `speakeasy
overlay apply --strict`.
- Added semantic exception for clarity:
  - `PATCH /api/v1/controls/{control_id}` -> `controls.updateMetadata`
  - `PUT /api/v1/controls/{control_id}/data` -> `controls.updateData`
- Updated SDK/docs/tests/examples to the shorter method surface (`list`,
`get`, `create`, `update*`, `delete`, `evaluate`, etc.).

## Guardrails and CI
- Added `make sdk-ts-name-check` heuristic for verbose fallback names.
- Added Python unit tests for naming generator:
`sdks/typescript/tests/test_generate_method_names_overlay.py`.
- Added `make sdk-ts-overlay-test` and wired it into CI.
- Tightened `generate-check` to verify both generated SDK code and
overlay drift:
  - `src/generated`
  - `overlays/method-names.overlay.yaml`

## Validation
- `make sdk-ts-overlay-test`
- `make sdk-ts-name-check`
- `make sdk-ts-lint`
- `make sdk-ts-typecheck`
- `make sdk-ts-test`
- `make sdk-ts-build`
- `make sdk-ts-generate-check`

## Notes
- TypeScript SDK package version moved to `0.2.0` due to method-surface
changes.
- `sdk-ts-ci` includes naming generator tests and generated/overlay
drift checks.
…olved

# Conflicts:
#	src/agents/pi-embedded-runner/run/attempt.test.ts
…egration

# Conflicts:
#	src/agents/pi-embedded-runner/run/attempt.e2e.test.ts
#	src/agents/pi-embedded-runner/run/attempt.ts
#	src/agents/tools/gateway.ts
#	src/shared/operator-scope-compat.test.ts
#	src/shared/operator-scope-compat.ts
…w into lev/agent-control-integration

# Conflicts:
#	src/agents/pi-embedded-runner/run/attempt.test.ts
#	src/agents/pi-embedded-runner/run/attempt.ts
lan17 pushed a commit that referenced this pull request Mar 2, 2026
… and docs (openclaw#16761)

Add inline file attachment support for sessions_spawn (subagent runtime only):

- Schema: attachments[] (name, content, encoding, mimeType) and attachAs.mountPath hint
- Materialization: files written to .openclaw/attachments/<uuid>/ with manifest.json
- Validation: strict base64 decode, filename checks, size limits, duplicate detection
- Transcript redaction: sanitizeToolCallInputs redacts attachment content from persisted transcripts
- Lifecycle cleanup: safeRemoveAttachmentsDir with symlink-safe path containment check
- Config: tools.sessions_spawn.attachments (enabled, maxFiles, maxFileBytes, maxTotalBytes, retainOnSessionKeep)
- Registry: attachmentsDir/attachmentsRootDir/retainAttachmentsOnKeep on SubagentRunRecord
- ACP rejection: attachments rejected for runtime=acp with clear error message
- Docs: updated tools/index.md, concepts/session-tool.md, configuration-reference.md
- Tests: 85 new/updated tests across 5 test files

Fixes:
- Guard fs.rm in materialization catch block with try/catch (review concern #1)
- Remove unreachable fallback in safeRemoveAttachmentsDir (review concern openclaw#7)
- Move attachment cleanup out of retry path to avoid timing issues with announce loop

Co-authored-by: Tyler Yust <TYTYYUST@YAHOO.COM>
Co-authored-by: napetrov <napetrov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant