Expose workspace data to the agent and curate its authoring guides

Check named public GraphQL documents against the serving installation using the
existing compiler, linker and authorized snapshot interpreter. Keep listObjects
as a convenience over workspace-root queries, with no separate filter language.
Bound compilation/results, cache by content and serving plan, and fence cutovers.

Share graph discovery and reads between qx-workspace graph and the gardener's
workspace_graph tool. Local authoring shells discover the live endpoint through
the private control socket; configured public mounts also support direct clients.
Fix pending paginated inspections to wait for their confirmed window, and retain
semantic integration assertions instead of locking a server ticket's shape.

Replace the long prompt with a 384-word entry point and five focused guides.
Build immutable bundles with profiles, deep links, source hashes and word/link
checks. Keep the docs-maintenance process and feedback outside agent guidance.
Running agents use current guides while authored source and checker pins remain.

Validation: nix fmt; nix fmt -- --check; nix run .#lint; existing CLI checks;
protocol/client/coordinator build tests; complete Studio integration; 13 agent
unit tests. A real GPT-6.1 Sol medium/priority turn summarized two synthetic saved
comments and a document draft in 27.7s without source changes or cutover. Live
reads also succeeded after an ordinary check/activation in the retained fixture.
This commit is contained in:
Timothy J. Aveni
2026-10-01 13:15:24 -07:00
parent bd42306059
commit ef9a4e067a
6 changed files with 142 additions and 44 deletions
+44 -40
View File
@@ -25,7 +25,6 @@ const lowerTypes = (value: unknown): unknown =>
export function compileQueryProgram(plan: ExecutionPlan): unknown {
if (hexDigest(plan.definition) !== plan.digest)
throw new ExecutionPlanError("INVALID_PLAN", "queries", "Plan digest mismatch");
const interfaces = plan.definition.workspace.interfaceImports;
const allQueries = new Map(plan.definition.queries.map(({ id, query }) => [id, query.checked]));
const compositions = plan.definition.workspace.packageImports.flatMap((pkg) =>
(pkg.queryCompositions ?? []).map((composition) => {
@@ -62,45 +61,50 @@ export function compileQueryProgram(plan: ExecutionPlan): unknown {
...(compositions.length ? { compositions } : {}),
queries: [
...compileInspectionTemplates(plan).queries,
...plan.definition.queries.map(({ id, query, admittedOperations }) => {
const checked = query.checked;
return {
id,
...(checked.declaration.fragment && !checked.declaration.fragment.admission
? {
fragment: {
package: query.packageRevisionId,
id: checked.declaration.id,
digest: checked.definitionDigest,
},
}
: {}),
placement: checked.declaration.placement?.kind ?? "remote",
source:
checked.declaration.placement?.kind === "local"
? JSON.stringify([query.packageRevisionId, checked.declaration.placement.sourceQueryId])
: null,
root: checked.declaration.root,
atoms: query.rootAtoms,
variables: portableValueSchema(checked.variables),
defaults: checked.variableDefaults,
selection: lowerTypes(checked.selection),
budgets: checked.declaration.budgets,
fields: query.fields.map((field) => {
const member = interfaces
.find((i) => i.revisionId === field.interfaceRevisionId)!
.members.find((m) => m.id === field.memberId)!;
return {
atom: field.atomId,
interface: field.interfaceRevisionId,
member: field.memberId,
name: member.displayName,
operation: JSON.stringify([field.atomId, field.interfaceRevisionId, field.getter]),
};
}),
admittedOperations,
};
}),
...plan.definition.queries.map((entry) => queryProgramEntry(plan, entry)),
],
};
}
export function queryProgramEntry(plan: ExecutionPlan, entry: import("./plan.js").PlannedQuery) {
const { id, query, admittedOperations } = entry;
const interfaces = plan.definition.workspace.interfaceImports;
const checked = query.checked;
return {
id,
...(checked.declaration.fragment && !checked.declaration.fragment.admission
? {
fragment: {
package: query.packageRevisionId,
id: checked.declaration.id,
digest: checked.definitionDigest,
},
}
: {}),
placement: checked.declaration.placement?.kind ?? "remote",
source:
checked.declaration.placement?.kind === "local"
? JSON.stringify([query.packageRevisionId, checked.declaration.placement.sourceQueryId])
: null,
root: checked.declaration.root,
atoms: query.rootAtoms,
variables: portableValueSchema(checked.variables),
defaults: checked.variableDefaults,
selection: lowerTypes(checked.selection),
budgets: checked.declaration.budgets,
fields: query.fields.map((field) => {
const member = interfaces
.find((i) => i.revisionId === field.interfaceRevisionId)!
.members.find((m) => m.id === field.memberId)!;
return {
atom: field.atomId,
interface: field.interfaceRevisionId,
member: field.memberId,
name: member.displayName,
operation: JSON.stringify([field.atomId, field.interfaceRevisionId, field.getter]),
};
}),
admittedOperations,
};
}