Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Name org credentials by slug everywhere (#2413)

Regan Bellf3da5b7137e7
diff --git a/skills-seed/browse/SKILL.md b/skills-seed/browse/SKILL.md
index 17252c0b9..9e8fe404e 100644
--- a/skills-seed/browse/SKILL.md
+++ b/skills-seed/browse/SKILL.md
@@ -23,13 +23,13 @@ org credential delivered as sandbox env (admin UI → Service credentials → de
env"), and it rides into every all-internal conversation — nothing here is deploy config. A
person's own keychain key overrides the org one. A provider can also be offered as a shared
credential you call through QM's broker without ever holding the key; the provider doc
-says so when it supports that (Kernel does, via `service_kernel`). Keys you may see today:
+says so when it supports that (Kernel does, via `kernel`). Keys you may see today:
Use the absolute directory reported by the skill read for all `providers/` paths below.
Keep the same explicit `sandbox_id` for the skill read and every `execute` command
in this flow, including the runner.
-- `KERNEL_API_KEY`, or a `service_kernel` shared credential in your inventory →
+- `KERNEL_API_KEY`, or a `kernel` shared credential in your inventory →
**Kernel** (onkernel.com). Read `providers/kernel.md`.
- `ANCHOR_API_KEY` → **Anchor** (anchorbrowser.io). Read `providers/anchor.md`.
- `BROWSERBASE_API_KEY` → **Browserbase** (browserbase.com). Read
diff --git a/skills-seed/browse/providers/kernel.md b/skills-seed/browse/providers/kernel.md
index 75a10f815..e8ed3695d 100644
--- a/skills-seed/browse/providers/kernel.md
+++ b/skills-seed/browse/providers/kernel.md
@@ -17,8 +17,8 @@ Use the first of these that exists:
1. **The person's own key**: a `KERNEL_API_KEY` handle of theirs in your keychain
manifest. Name it in `credentials`.
2. **An org key delivered as env**: `KERNEL_API_KEY` already set in your shell.
-3. **The org's shared Kernel credential**: a `service_kernel` row in the Credentials
- inventory (proxy, host `api.onkernel.com`). Name `service_kernel` in `credentials`.
+3. **The org's shared Kernel credential**: a `kernel` row in the Credentials
+ inventory (proxy, host `api.onkernel.com`). Name `kernel` in `credentials`.
You never see this key. QM adds it to each request you send through its credential
broker (see the use-shared-credential skill), so `KERNEL_API_KEY` stays unset.
@@ -82,7 +82,7 @@ This doc's isolation depends on two settings that the skill can't enforce itself
restricted to it, for the same reason as above: within one project, any key that can
create browsers can see every running browser.
-If you're an agent and the `service_kernel` row in your inventory allows `GET`, tell the person
+If you're an agent and the `kernel` row in your inventory allows `GET`, tell the person
(and an org admin) that profiles aren't isolated yet. Don't work around it.
## Profiles
diff --git a/skills-seed/use-shared-credential/SKILL.md b/skills-seed/use-shared-credential/SKILL.md
index 448ac257a..703ad0468 100644
--- a/skills-seed/use-shared-credential/SKILL.md
+++ b/skills-seed/use-shared-credential/SKILL.md
@@ -14,7 +14,7 @@ core stamps the secret onto the outbound call at the wire and returns the respon
## When this applies
The **Credentials** inventory groups available credentials by owner. Organization rows marked
-`proxy` give the host and allowed methods/paths. Select the exact `service_<slug>` handle in
+`proxy` give the host and allowed methods/paths. Select that credential's handle (e.g. `gitlab`) in
`execute.credentials` for the command making the request, with an explicit `sandbox_id`. Core supplies
`AGENT_CREDENTIAL_TOKEN` only to that command; its absence before selection does not mean
access is missing. Use that token, not `AGENT_API_TOKEN`, for broker requests.
diff --git a/src/core/orchestrator.ts b/src/core/orchestrator.ts
index 46b9e88bf..b9de3bebc 100644
--- a/src/core/orchestrator.ts
+++ b/src/core/orchestrator.ts
@@ -1738,7 +1738,7 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
(record) => !isBackendCredential(record) && record.enabled && record.hasSecret && granted.has(record.slug),
);
const brokerSlugs = available
- .filter((record) => record.delivery !== "env" && requestedHandles.includes(`service_${record.slug}`))
+ .filter((record) => record.delivery !== "env" && requestedHandles.includes(record.slug))
.map((record) => record.slug)
.sort();
let brokerToken: Promise<string> | undefined;
@@ -1776,7 +1776,7 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
if ((!allInternal && !external) || !credential.envKey) continue;
addCredential(
{
- handle: `service_${credential.slug}`,
+ handle: credential.slug,
resolve: async () => {
await authorizeServiceCredential(credential.slug);
const current = await deps.serviceCreds!.getServiceCredentialSecret(
@@ -1802,7 +1802,7 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
} else if (deps.signingSecret && deps.apiBaseUrl) {
addCredential(
{
- handle: `service_${credential.slug}`,
+ handle: credential.slug,
resolve: async () => ({ env: [{ key: "AGENT_CREDENTIAL_TOKEN", value: await resolveBrokerToken() }] }),
},
`${credential.name}; proxy ${credential.host}; ${(credential.allowedMethods?.length ? credential.allowedMethods : ["GET"]).toSorted().join("/")}; ${credential.allowedPathPrefixes?.length ? `paths ${credential.allowedPathPrefixes.toSorted().join(", ")}` : "any path"}; use the use-shared-credential skill`,
diff --git a/test/deployment-broker-credentials.test.ts b/test/deployment-broker-credentials.test.ts
index b8cf58791..a2f0b665f 100644
--- a/test/deployment-broker-credentials.test.ts
+++ b/test/deployment-broker-credentials.test.ts
@@ -292,9 +292,7 @@ test("org members' agents get a deployment credential by broker only, as if gran
await selectDefaultSandbox(built, "U1", "personal:U1");
const prompt = await built.app.turn(dm("!sysprompt"));
assert.match(prompt.reply ?? "", /search.*Web search.*api\.search\.example.*POST.*\/search/s);
- const res = await built.app.turn(
- dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["service_search"] })}`),
- );
+ const res = await built.app.turn(dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["search"] })}`));
assert.equal(res.status, "ok", res.reason);
assert.ok(executed?.AGENT_CREDENTIAL_TOKEN, "expected a broker token");
assert.doesNotMatch(JSON.stringify(executed), new RegExp(KEY));
diff --git a/test/external-slack-core.test.ts b/test/external-slack-core.test.ts
index c2e665e1d..9696d8dfc 100644
--- a/test/external-slack-core.test.ts
+++ b/test/external-slack-core.test.ts
@@ -88,9 +88,9 @@ test("external Slack strips private and org preloads before the prompt, but keep
assert.equal(prompt.status, "ok", JSON.stringify(prompt));
assert.doesNotMatch(
prompt.reply!,
- /PERSONAL_MEMORY_SENTINEL|ORG_MEMORY_SENTINEL|ORG_SOUL_SENTINEL|PERSONAL_FILE_SENTINEL|ORG_FILE_SENTINEL|service_confidential/,
+ /PERSONAL_MEMORY_SENTINEL|ORG_MEMORY_SENTINEL|ORG_SOUL_SENTINEL|PERSONAL_FILE_SENTINEL|ORG_FILE_SENTINEL|confidential/,
);
- assert.match(prompt.reply!, /service_safe/);
+ assert.match(prompt.reply!, /safe/);
const provisions: string[][] = [];
const provision = b.sandbox.provision.bind(b.sandbox);
b.sandbox.provision = (layers, opts) => {
@@ -108,7 +108,7 @@ test("external Slack strips private and org preloads before the prompt, but keep
return run(handle, command, opts);
};
const code = await b.app.turn(
- request(`!execute ${JSON.stringify({ command: "printf external-code-ok", credentials: ["service_safe"] })}`),
+ request(`!execute ${JSON.stringify({ command: "printf external-code-ok", credentials: ["safe"] })}`),
);
assert.equal(code.status, "ok", JSON.stringify(code));
assert.match(code.reply!, /external-code-ok/);
diff --git a/test/loop-execution.test.ts b/test/loop-execution.test.ts
index ebd0d96f7..7534e802d 100644
--- a/test/loop-execution.test.ts
+++ b/test/loop-execution.test.ts
@@ -57,7 +57,7 @@ for (const checkResult of ["passed", "failed", "missing"] as const) {
...req,
text:
stage === "intake"
- ? `!execute ${JSON.stringify({ command, credentials: ["service_error-source"] })}`
+ ? `!execute ${JSON.stringify({ command, credentials: ["error-source"] })}`
: `!run ${command}`,
});
assert.equal(result.status, "ok");
diff --git a/test/orchestrator.test.ts b/test/orchestrator.test.ts
index 82ae1f97e..cfd1a8f7e 100644
--- a/test/orchestrator.test.ts
+++ b/test/orchestrator.test.ts
@@ -610,10 +610,10 @@ test("Composio backend access is announced without delivering the project key",
const granted = await prompt("granted");
assert.match(granted, /## Connected app access/);
assert.match(granted, /Composio is configured in the backend/);
- assert.doesNotMatch(granted, /service_composio/);
+ assert.doesNotMatch(granted, /`composio`/);
await assert.rejects(
app.turn(
- dm(`!execute ${JSON.stringify({ command: "true", credentials: ["service_composio"] })}`, {
+ dm(`!execute ${JSON.stringify({ command: "true", credentials: ["composio"] })}`, {
conversation: { kind: "dm", threadRef: "dm:U1:composio-explicit" },
}),
),
@@ -635,7 +635,7 @@ test("Composio backend access is announced without delivering the project key",
);
const brokerDelivery = await prompt("backend-broker-delivery");
assert.match(brokerDelivery, /Composio is configured in the backend/);
- assert.doesNotMatch(brokerDelivery, /service_composio|Shared org credentials available to you/);
+ assert.doesNotMatch(brokerDelivery, /`composio`|Shared org credentials available to you/);
serviceCreds.listServiceCredentials = listServiceCredentials;
await acl.revoke(org, encodeRef(serviceCredRef("composio")), org, "admin@default-org");
assert.doesNotMatch(await prompt("revoked"), /COMPOSIO_API_KEY/);
@@ -691,7 +691,7 @@ test("org credentials are delivered only when requested and read live after rota
return realProvision(layers, opts);
};
- const request = `!execute ${JSON.stringify({ command: "echo keys", credentials: ["service_browse-steel", "service_browse-model-key"] })}`;
+ const request = `!execute ${JSON.stringify({ command: "echo keys", credentials: ["browse-steel", "browse-model-key"] })}`;
let res = await app.turn(dm(request, { conversation: { kind: "dm", threadRef: "dm:U1:env1" } }));
assert.equal(res.status, "ok");
assert.equal(captures.at(-1)?.env?.STEEL_API_KEY, undefined);
@@ -752,7 +752,7 @@ test("a disabled or broker-delivery credential never rides provision env", async
const res = await app.turn(dm("!sysprompt", { conversation: { kind: "dm", threadRef: "dm:U1:env3" } }));
assert.equal(res.status, "ok");
- assert.doesNotMatch(res.reply ?? "", /service_browse-steel/g);
+ assert.doesNotMatch(res.reply ?? "", /browse-steel/g);
const env = captures.at(-1)?.env ?? {};
assert.equal(env.STEEL_API_KEY, undefined, "disabled env credential stays home");
assert.ok(
@@ -792,7 +792,7 @@ test("a credential flipped away from env between the metadata read and the secre
await assert.rejects(
app.turn(
- dm(`!execute ${JSON.stringify({ command: "echo keys", credentials: ["service_browse-steel"] })}`, {
+ dm(`!execute ${JSON.stringify({ command: "echo keys", credentials: ["browse-steel"] })}`, {
conversation: { kind: "dm", threadRef: "dm:U1:env4" },
}),
),
@@ -837,7 +837,7 @@ test("env-delivery credentials are not offered to an external audience", async (
}),
);
assert.equal(externalRoom.status, "ok");
- assert.doesNotMatch(externalRoom.reply ?? "", /service_browse-steel/g);
+ assert.doesNotMatch(externalRoom.reply ?? "", /browse-steel/g);
assert.equal(captures.at(-1)?.env?.STEEL_API_KEY, undefined, "a room with externals gets no org env credentials");
});
@@ -907,7 +907,7 @@ test("a channel cron receives env credentials only when the directory proves an
ownerScopeId: scopeId("channel", channelId),
input:
channelId === "C-internal"
- ? `!execute ${JSON.stringify({ command: "echo keys", credentials: ["service_browse-steel"] })}`
+ ? `!execute ${JSON.stringify({ command: "echo keys", credentials: ["browse-steel"] })}`
: "!sysprompt",
fireKey: `cron:${channelId}:1`,
surface: "cron",
@@ -916,7 +916,7 @@ test("a channel cron receives env credentials only when the directory proves an
assert.equal(out.status, "ok", `the ${channelId} cron turn runs`);
assert.equal(captures.at(-1)?.env?.STEEL_API_KEY, undefined);
if (channelId !== "C-internal") {
- assert.doesNotMatch(out.reply ?? "", /service_browse-steel/);
+ assert.doesNotMatch(out.reply ?? "", /browse-steel/);
return undefined;
}
return executions.findLast((handle) => handle.env?.STEEL_API_KEY)?.env?.STEEL_API_KEY;
@@ -958,18 +958,18 @@ test("env-delivery credentials are gated by service-cred grants — no grant, no
let res = await app.turn(dm("!sysprompt", { conversation: { kind: "dm", threadRef: "dm:U1:gate1" } }));
assert.equal(res.status, "ok");
- assert.doesNotMatch(res.reply ?? "", /service_browse-steel/g);
+ assert.doesNotMatch(res.reply ?? "", /browse-steel/g);
assert.equal(captures.at(-1)?.env?.STEEL_API_KEY, undefined, "ungranted env credential stays home");
await grantCred(acl, org, "browse-steel", scopeId("personal", "somebody-else"));
res = await app.turn(dm("!sysprompt", { conversation: { kind: "dm", threadRef: "dm:U1:gate2" } }));
assert.equal(res.status, "ok");
- assert.doesNotMatch(res.reply ?? "", /service_browse-steel/g);
+ assert.doesNotMatch(res.reply ?? "", /browse-steel/g);
assert.equal(captures.at(-1)?.env?.STEEL_API_KEY, undefined, "a grant to someone else does not admit this actor");
await grantCred(acl, org, "browse-steel", scopeId("personal", "U1"));
res = await app.turn(
- dm(`!execute ${JSON.stringify({ command: "echo keys", credentials: ["service_browse-steel"] })}`, {
+ dm(`!execute ${JSON.stringify({ command: "echo keys", credentials: ["browse-steel"] })}`, {
conversation: { kind: "dm", threadRef: "dm:U1:gate3" },
}),
);
@@ -1180,7 +1180,7 @@ for (const hours of [undefined, "72", "0", "none"]) {
};
const before = Date.now();
const res = await app.turn(
- dm(`!execute ${JSON.stringify({ command: "echo ttl", credentials: ["service_test-service"] })}`),
+ dm(`!execute ${JSON.stringify({ command: "echo ttl", credentials: ["test-service"] })}`),
);
assert.equal(res.status, "ok", res.reason);
const tokens = {
diff --git a/test/service-credential-route.test.ts b/test/service-credential-route.test.ts
index 163193a17..061e75553 100644
--- a/test/service-credential-route.test.ts
+++ b/test/service-credential-route.test.ts
@@ -1056,7 +1056,7 @@ test("orchestrator vends a capability for only the requested org credential", as
await built.app.turn(dm("!run echo hi"));
assert.equal(executionEnv()?.AGENT_CREDENTIAL_TOKEN, undefined);
const res = await built.app.turn(
- dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["service_x-firehose"] })}`),
+ dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["x-firehose"] })}`),
);
assert.equal(res.status, "ok", res.reason);
assert.equal(env()?.AGENT_CREDENTIAL_TOKEN, undefined);
@@ -1080,7 +1080,7 @@ test("orchestrator vends a capability for only the requested org credential", as
audience: [actor],
publishMembers: [actor],
},
- text: `!execute ${JSON.stringify({ command: "echo bot", credentials: ["service_x-firehose"] })}`,
+ text: `!execute ${JSON.stringify({ command: "echo bot", credentials: ["x-firehose"] })}`,
});
const botClaims = await verifyCapabilityToken(executionEnv()!.AGENT_CREDENTIAL_TOKEN!, TEST_CAPABILITY_SECRET);
assert.equal(botClaims?.botActor, true);
@@ -1106,7 +1106,7 @@ test("orchestrator does NOT stamp a credential granted only to someone else", as
await selectDefaultSandbox(built, "U1", "personal:U1");
await assert.rejects(
- built.app.turn(dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["service_x-firehose"] })}`)),
+ built.app.turn(dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["x-firehose"] })}`)),
/not available/,
);
const res = await built.app.turn(dm("!run echo hi"));
@@ -1148,7 +1148,7 @@ test("a channel grantee stamps the credential in that channel's conversations an
assert.equal(executionEnv()?.AGENT_CREDENTIAL_TOKEN, undefined);
let res = await built.app.turn({
...channelTurn("C1"),
- text: `!execute ${JSON.stringify({ command: "echo hi", credentials: ["service_x-firehose"] })}`,
+ text: `!execute ${JSON.stringify({ command: "echo hi", credentials: ["x-firehose"] })}`,
});
assert.equal(res.status, "ok", res.reason);
assert.equal(env()?.AGENT_CREDENTIAL_TOKEN, undefined);
@@ -1160,7 +1160,7 @@ test("a channel grantee stamps the credential in that channel's conversations an
await assert.rejects(
built.app.turn({
...channelTurn("C2"),
- text: `!execute ${JSON.stringify({ command: "echo hi", credentials: ["service_x-firehose"] })}`,
+ text: `!execute ${JSON.stringify({ command: "echo hi", credentials: ["x-firehose"] })}`,
}),
/not available/,
);
@@ -1169,7 +1169,7 @@ test("a channel grantee stamps the credential in that channel's conversations an
assert.equal(env()?.AGENT_CREDENTIAL_TOKEN, undefined, "another channel must not get the credential");
await assert.rejects(
- built.app.turn(dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["service_x-firehose"] })}`)),
+ built.app.turn(dm(`!execute ${JSON.stringify({ command: "echo hi", credentials: ["x-firehose"] })}`)),
/not available/,
);
res = await built.app.turn(dm("!run echo hi"));
@@ -1367,8 +1367,8 @@ test("credential inventory and policy reordering do not resend unchanged credent
}
const first = await built.app.turn(dm("!sysprompt"));
assert.equal(first.status, "ok");
- assert.match(first.reply ?? "", /service_z-service/);
- assert.match(first.reply ?? "", /service_a-service/);
+ assert.match(first.reply ?? "", /z-service/);
+ assert.match(first.reply ?? "", /a-service/);
assert.match(first.reply ?? "", /### Organization/);
const list = built.serviceCreds.listServiceCredentials.bind(built.serviceCreds);
built.serviceCreds.listServiceCredentials = async (...args) =>