Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

fix: clarify publish tool configuration (#1558)

Joshua Francea0f8485be0bf
diff --git a/src/harness/agent-tools.ts b/src/harness/agent-tools.ts
index 8f22f2eae..4f2126d19 100644
--- a/src/harness/agent-tools.ts
+++ b/src/harness/agent-tools.ts
@@ -1111,9 +1111,15 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):
label: "publish",
description:
"Publish a directory from the workspace as a durable, scope-bound internal web app " +
- "(it keeps running after the turn ends and gets a stable link). The app must listen on " +
- "the PORT env var. Set audience to [] to suppress default audience grants, or supply publication-time grants. Use apps action share for subsequent grants. Share the full absolute URL returned by apps action publish so it works in Slack and other surfaces. Use `name` for a friendly, stable link /d/<name>/; " +
- "`renameFrom` to rename; `rollbackTo` to flip back to an earlier version. Egress is open, " +
+ "(it keeps running after the turn ends and gets a stable link). Before publishing, verify the " +
+ "directory exists and contains files. For a new app or a code/file update, always pass `entrypoint`; " +
+ "the app must listen on the PORT env var. `dir` is workspace-relative: use `app`, never a path " +
+ "beginning with `/` or a redundant `workspace/app`. `renameFrom` takes an existing " +
+ "deployment name, not its ID. Set audience to [] to suppress default audience grants, or supply " +
+ "publication-time grants. Use apps action share for subsequent grants. Share the full absolute URL " +
+ "returned by apps action publish so it works in Slack and other surfaces. Use `name` for a friendly, " +
+ "stable link /d/<name>/; `renameFrom` to rename; `rollbackTo` to flip back to an earlier version. " +
+ "Egress is open, " +
"so bake data in or have the app fetch it. When the runtime sets $DATA_DIR, state the app " +
"writes there survives restarts and redeploys; keep durable state there. For a database use " +
"SQLite at exactly $DATA_DIR/app.db — it gets the strongest durability the runtime offers " +
@@ -1135,16 +1141,26 @@ export function createAgentTools(ref: ToolContextRef, opts?: AgentToolsOptions):
},
),
),
- dir: Type.Optional(Type.String({ description: "Workspace directory to publish (default: the whole tree)." })),
+ dir: Type.Optional(
+ Type.String({
+ description:
+ "Workspace-relative directory to publish (default: the whole tree). Use `app`, not an absolute path or `workspace/app`.",
+ }),
+ ),
entrypoint: Type.Optional(
- Type.String({ description: 'Command the container runs, relative to the app root, e.g. "node server.js".' }),
+ Type.String({
+ description:
+ 'Command the container runs, relative to the app root, e.g. "node server.js". Always provide it for a new app or file update.',
+ }),
),
name: Type.Optional(
Type.String({
description: "Friendly, globally-unique handle → link is /d/<name>/. Lowercase letters/digits/hyphens.",
}),
),
- renameFrom: Type.Optional(Type.String({ description: "Rename the deployment currently named this to `name`." })),
+ renameFrom: Type.Optional(
+ Type.String({ description: "Existing deployment name to rename to `name`; this is a name, not an ID." }),
+ ),
env: Type.Optional(
Type.Record(Type.String(), Type.String(), {
description:
diff --git a/test/agent-tools.test.ts b/test/agent-tools.test.ts
index 4ab363668..19a7aa016 100644
--- a/test/agent-tools.test.ts
+++ b/test/agent-tools.test.ts
@@ -1901,6 +1901,15 @@ test('execute scope:"owner" routes only when the owner-auth surface is enabled',
);
});
+test("publish instructions prevent malformed app configs", () => {
+ const apps = createAgentTools({ current: fakeToolContext() }).find((tool) => tool.name === "apps");
+ assert.ok(apps);
+ assert.match(apps.description, /always pass `entrypoint`/);
+ assert.match(apps.description, /workspace-relative/);
+ assert.match(apps.description, /verify.*directory.*contains files/i);
+ assert.match(apps.description, /`renameFrom`.*deployment name.*not.*ID/i);
+});
+
test("publish reply states owner + resolved audience in human terms (ADR 0003 D7)", async () => {
const textOf = (r: unknown): string => (r as { content: Array<{ text: string }> }).content[0]?.text ?? "";
const withAudience = (audience: unknown): ToolContext => ({