@agentic-kit/pi 0.11.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/confirm-gate.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type GatePolicy } from '@agentic-kit/harness';
1
2
  import type { ExtensionContext, ToolCallEvent, ToolCallEventResult } from '@earendil-works/pi-coding-agent';
2
3
  import type { resolveDataToken, resolveProjectContext } from './context';
3
4
  import type { createTemplatePreviewTables } from './tools/templates';
@@ -5,9 +6,19 @@ export type ConfirmGateDeps = {
5
6
  resolveProjectContext: typeof resolveProjectContext;
6
7
  resolveDataToken: typeof resolveDataToken;
7
8
  createTemplatePreviewTables: typeof createTemplatePreviewTables;
9
+ /** Tool names to gate; defaults to the harness's `MUTATING_DB_TOOLS`. */
10
+ gatedTools?: ReadonlySet<string>;
11
+ };
12
+ /**
13
+ * Constructive's database deps, or a `GatePolicy` of the host's own — a pi
14
+ * host with no Constructive project (a remote coding job gating `bash`) has
15
+ * nothing to give the former.
16
+ */
17
+ export type ConfirmGateOptions = ConfirmGateDeps | {
18
+ policy: GatePolicy;
8
19
  };
9
20
  export type ConfirmGate = {
10
21
  onAgentStart: () => void;
11
22
  onToolCall: (event: ToolCallEvent, ctx: ExtensionContext) => Promise<ToolCallEventResult | undefined>;
12
23
  };
13
- export declare function createConfirmGate(deps: ConfirmGateDeps): ConfirmGate;
24
+ export declare function createConfirmGate(options: ConfirmGateOptions): ConfirmGate;
package/confirm-gate.js CHANGED
@@ -2,34 +2,37 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createConfirmGate = createConfirmGate;
4
4
  const harness_1 = require("@agentic-kit/harness");
5
- function createConfirmGate(deps) {
6
- const gate = (0, harness_1.createConfirmGate)({
7
- isProjectRunnable: async (cwd) => {
8
- const resolved = await deps.resolveProjectContext(cwd);
9
- return resolved.context !== null;
10
- },
11
- hasDataToken: async (cwd) => {
12
- const resolved = await deps.resolveProjectContext(cwd);
13
- if (!resolved.context)
14
- return false;
15
- const token = await deps.resolveDataToken(resolved.context);
16
- return Boolean(token.token);
17
- },
18
- resolveTemplatePreview: async (cwd, blueprintName, displayName) => {
19
- const resolved = await deps.resolveProjectContext(cwd);
20
- if (!resolved.context)
21
- return undefined;
22
- const result = await deps.createTemplatePreviewTables(resolved.context, blueprintName);
23
- if (result.tables.length === 0)
24
- return undefined;
25
- return {
26
- kind: 'template',
27
- displayName,
28
- blueprintName: result.blueprintName || undefined,
29
- tables: result.tables,
30
- };
31
- },
32
- });
5
+ function createConfirmGate(options) {
6
+ const gate = (0, harness_1.createConfirmGate)('policy' in options
7
+ ? options
8
+ : {
9
+ gatedTools: options.gatedTools,
10
+ isProjectRunnable: async (cwd) => {
11
+ const resolved = await options.resolveProjectContext(cwd);
12
+ return resolved.context !== null;
13
+ },
14
+ hasDataToken: async (cwd) => {
15
+ const resolved = await options.resolveProjectContext(cwd);
16
+ if (!resolved.context)
17
+ return false;
18
+ const token = await options.resolveDataToken(resolved.context);
19
+ return Boolean(token.token);
20
+ },
21
+ resolveTemplatePreview: async (cwd, blueprintName, displayName) => {
22
+ const resolved = await options.resolveProjectContext(cwd);
23
+ if (!resolved.context)
24
+ return undefined;
25
+ const result = await options.createTemplatePreviewTables(resolved.context, blueprintName);
26
+ if (result.tables.length === 0)
27
+ return undefined;
28
+ return {
29
+ kind: 'template',
30
+ displayName,
31
+ blueprintName: result.blueprintName || undefined,
32
+ tables: result.tables,
33
+ };
34
+ },
35
+ });
33
36
  return {
34
37
  onAgentStart: gate.onAgentStart,
35
38
  onToolCall: async (event, ctx) => {
@@ -1,3 +1,4 @@
1
+ import { type GatePolicy } from '@agentic-kit/harness';
1
2
  import type { ExtensionContext, ToolCallEvent, ToolCallEventResult } from '@earendil-works/pi-coding-agent';
2
3
  import type { resolveDataToken, resolveProjectContext } from './context';
3
4
  import type { createTemplatePreviewTables } from './tools/templates';
@@ -5,9 +6,19 @@ export type ConfirmGateDeps = {
5
6
  resolveProjectContext: typeof resolveProjectContext;
6
7
  resolveDataToken: typeof resolveDataToken;
7
8
  createTemplatePreviewTables: typeof createTemplatePreviewTables;
9
+ /** Tool names to gate; defaults to the harness's `MUTATING_DB_TOOLS`. */
10
+ gatedTools?: ReadonlySet<string>;
11
+ };
12
+ /**
13
+ * Constructive's database deps, or a `GatePolicy` of the host's own — a pi
14
+ * host with no Constructive project (a remote coding job gating `bash`) has
15
+ * nothing to give the former.
16
+ */
17
+ export type ConfirmGateOptions = ConfirmGateDeps | {
18
+ policy: GatePolicy;
8
19
  };
9
20
  export type ConfirmGate = {
10
21
  onAgentStart: () => void;
11
22
  onToolCall: (event: ToolCallEvent, ctx: ExtensionContext) => Promise<ToolCallEventResult | undefined>;
12
23
  };
13
- export declare function createConfirmGate(deps: ConfirmGateDeps): ConfirmGate;
24
+ export declare function createConfirmGate(options: ConfirmGateOptions): ConfirmGate;
@@ -1,32 +1,35 @@
1
1
  import { createConfirmGate as createHarnessConfirmGate, } from '@agentic-kit/harness';
2
- export function createConfirmGate(deps) {
3
- const gate = createHarnessConfirmGate({
4
- isProjectRunnable: async (cwd) => {
5
- const resolved = await deps.resolveProjectContext(cwd);
6
- return resolved.context !== null;
7
- },
8
- hasDataToken: async (cwd) => {
9
- const resolved = await deps.resolveProjectContext(cwd);
10
- if (!resolved.context)
11
- return false;
12
- const token = await deps.resolveDataToken(resolved.context);
13
- return Boolean(token.token);
14
- },
15
- resolveTemplatePreview: async (cwd, blueprintName, displayName) => {
16
- const resolved = await deps.resolveProjectContext(cwd);
17
- if (!resolved.context)
18
- return undefined;
19
- const result = await deps.createTemplatePreviewTables(resolved.context, blueprintName);
20
- if (result.tables.length === 0)
21
- return undefined;
22
- return {
23
- kind: 'template',
24
- displayName,
25
- blueprintName: result.blueprintName || undefined,
26
- tables: result.tables,
27
- };
28
- },
29
- });
2
+ export function createConfirmGate(options) {
3
+ const gate = createHarnessConfirmGate('policy' in options
4
+ ? options
5
+ : {
6
+ gatedTools: options.gatedTools,
7
+ isProjectRunnable: async (cwd) => {
8
+ const resolved = await options.resolveProjectContext(cwd);
9
+ return resolved.context !== null;
10
+ },
11
+ hasDataToken: async (cwd) => {
12
+ const resolved = await options.resolveProjectContext(cwd);
13
+ if (!resolved.context)
14
+ return false;
15
+ const token = await options.resolveDataToken(resolved.context);
16
+ return Boolean(token.token);
17
+ },
18
+ resolveTemplatePreview: async (cwd, blueprintName, displayName) => {
19
+ const resolved = await options.resolveProjectContext(cwd);
20
+ if (!resolved.context)
21
+ return undefined;
22
+ const result = await options.createTemplatePreviewTables(resolved.context, blueprintName);
23
+ if (result.tables.length === 0)
24
+ return undefined;
25
+ return {
26
+ kind: 'template',
27
+ displayName,
28
+ blueprintName: result.blueprintName || undefined,
29
+ tables: result.tables,
30
+ };
31
+ },
32
+ });
30
33
  return {
31
34
  onAgentStart: gate.onAgentStart,
32
35
  onToolCall: async (event, ctx) => {
package/esm/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type PiToolsHost } from './host';
3
3
  export declare const dbTools: ExtensionFactory;
4
4
  /** Configure the host and get the extension in one call. */
5
5
  export declare function createDbTools(host: PiToolsHost): ExtensionFactory;
6
- export { type ConfirmGate, type ConfirmGateDeps, createConfirmGate } from './confirm-gate';
6
+ export { type ConfirmGate, type ConfirmGateDeps, type ConfirmGateOptions, createConfirmGate, } from './confirm-gate';
7
7
  export { deriveSubdomainEndpoint, type ModulesClient, type ProjectContext, resolveDataToken, resolveProjectContext, } from './context';
8
8
  export { type ActiveDataToken, configureHost, type DataAuthBroker, getHost, type HostAccount, type HostBackendConfig, type HostProvisionOverlay, type PiToolsHost, type PreviewToken, } from './host';
9
9
  export { loadProvisionManifest, parseProvisionManifest, PROVISION_MANIFEST_FILE, type ProvisionManifest, } from './provision-database/manifest';
package/esm/index.js CHANGED
@@ -44,7 +44,7 @@ export function createDbTools(host) {
44
44
  configureHost(host);
45
45
  return dbTools;
46
46
  }
47
- export { createConfirmGate } from './confirm-gate';
47
+ export { createConfirmGate, } from './confirm-gate';
48
48
  export { deriveSubdomainEndpoint, resolveDataToken, resolveProjectContext, } from './context';
49
49
  export { configureHost, getHost, } from './host';
50
50
  export { loadProvisionManifest, parseProvisionManifest, PROVISION_MANIFEST_FILE, } from './provision-database/manifest';
package/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type PiToolsHost } from './host';
3
3
  export declare const dbTools: ExtensionFactory;
4
4
  /** Configure the host and get the extension in one call. */
5
5
  export declare function createDbTools(host: PiToolsHost): ExtensionFactory;
6
- export { type ConfirmGate, type ConfirmGateDeps, createConfirmGate } from './confirm-gate';
6
+ export { type ConfirmGate, type ConfirmGateDeps, type ConfirmGateOptions, createConfirmGate, } from './confirm-gate';
7
7
  export { deriveSubdomainEndpoint, type ModulesClient, type ProjectContext, resolveDataToken, resolveProjectContext, } from './context';
8
8
  export { type ActiveDataToken, configureHost, type DataAuthBroker, getHost, type HostAccount, type HostBackendConfig, type HostProvisionOverlay, type PiToolsHost, type PreviewToken, } from './host';
9
9
  export { loadProvisionManifest, parseProvisionManifest, PROVISION_MANIFEST_FILE, type ProvisionManifest, } from './provision-database/manifest';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-kit/pi",
3
- "version": "0.11.1",
3
+ "version": "0.13.0",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "Pi adapter for agentic-kit — the Constructive typed db tools (provision, blueprint, codegen, records, policies, templates) and confirm gate as a pi coding-agent extension",
6
6
  "main": "index.js",
@@ -29,10 +29,10 @@
29
29
  "test:watch": "jest --watch"
30
30
  },
31
31
  "dependencies": {
32
- "@agentic-kit/harness": "^0.10.1",
32
+ "@agentic-kit/harness": "^0.12.0",
33
33
  "@constructive-io/graphql-query": "^4.12.10",
34
34
  "@constructive-io/sdk": "^1.11.11",
35
- "node-type-registry": "^1.15.0",
35
+ "node-type-registry": "^1.16.0",
36
36
  "zod": "^4.4.3"
37
37
  },
38
38
  "peerDependencies": {
@@ -48,5 +48,5 @@
48
48
  "coding-agent",
49
49
  "constructive"
50
50
  ],
51
- "gitHead": "a9dd614c27e520cad2a04231605444cdb9fa4aed"
51
+ "gitHead": "6d4354f47b8bd4d3d1c2bd918a12dcb0315e1931"
52
52
  }