@arnilo/prism-coding-agent 0.0.25 → 0.0.27
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/CHANGELOG.md +16 -0
- package/README.md +2 -2
- package/dist/delete.d.ts +3 -0
- package/dist/delete.js +3 -1
- package/dist/edit.d.ts +3 -0
- package/dist/edit.js +2 -1
- package/dist/execution-policy.d.ts +7 -1
- package/dist/execution-policy.js +4 -1
- package/dist/forge/github.d.ts +2 -0
- package/dist/forge/github.js +554 -0
- package/dist/forge/index.d.ts +3 -0
- package/dist/forge/index.js +3 -0
- package/dist/forge/types.d.ts +150 -0
- package/dist/forge/types.js +19 -0
- package/dist/git-aware-repository.d.ts +25 -0
- package/dist/git-aware-repository.js +268 -0
- package/dist/git-tools.d.ts +3 -0
- package/dist/git-tools.js +4 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +6 -1
- package/dist/language/client.d.ts +44 -0
- package/dist/language/client.js +290 -0
- package/dist/language/framing.d.ts +23 -0
- package/dist/language/framing.js +112 -0
- package/dist/language/index.d.ts +4 -0
- package/dist/language/index.js +4 -0
- package/dist/language/intelligence.d.ts +10 -0
- package/dist/language/intelligence.js +526 -0
- package/dist/language/types.d.ts +106 -0
- package/dist/language/types.js +21 -0
- package/dist/lifecycle.d.ts +75 -0
- package/dist/lifecycle.js +102 -0
- package/dist/limits.d.ts +41 -0
- package/dist/limits.js +41 -0
- package/dist/move.d.ts +3 -0
- package/dist/move.js +2 -1
- package/dist/output-accumulator.d.ts +8 -0
- package/dist/output-accumulator.js +45 -1
- package/dist/process/index.d.ts +3 -0
- package/dist/process/index.js +3 -0
- package/dist/process/sessions.d.ts +2 -0
- package/dist/process/sessions.js +592 -0
- package/dist/process/types.d.ts +146 -0
- package/dist/process/types.js +19 -0
- package/dist/repository.d.ts +21 -1
- package/dist/repository.js +10 -10
- package/dist/write.d.ts +3 -0
- package/dist/write.js +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.27] - 2026-08-07
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `createCodingLifecycleEmitter(options?)` — consumer-gated coding lifecycle events (Phase 10): ships `process_*` (reuses `CodingProcessEvent`) plus `file_changed`, `worktree_changed`, `permission_denied`, `configuration_changed`; synchronous bounded `emit`/`on`; drops unknown/oversized events without breaking producer paths; invalid limits fail closed with `CodingLifecycleError` (`ERR_PRISM_LIFECYCLE_LIMIT`); frozen `DEFAULT_LIFECYCLE_MAX_*` / `HARD_LIFECYCLE_MAX_*` caps.
|
|
7
|
+
- `onEvent` option on `createWriteTool` / `createEditTool` / `createMoveTool` / `createDeleteTool` / `createGitWorktreeTool` — tools emit `file_changed` (write/edit/move/delete) and `worktree_changed` (add/remove) after successful mutation, and `permission_denied` via the shared `enforceExecutionPolicy` deny hook (never raw tool arguments).
|
|
8
|
+
- `enforceExecutionPolicy(..., onDenied?)` — optional callback invoked once per policy denial (additive; existing callers unaffected).
|
|
9
|
+
|
|
10
|
+
## [0.0.26] - 2026-08-06
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `createGitHubForge(options)` — reference GitHub adapter: issue context, authenticated push (`GIT_CONFIG_*` credential injection, never argv), PR create/update, review comments, checks/status, bounded `reconcileHandoff`; every mutation gated by `ExecutionPolicy` and recorded in `ToolEffectStore` (retry never duplicates PRs/comments); typed `ERR_PRISM_FORGE_*` codes; frozen `DEFAULT_MAX_FORGE_*` / `HARD_MAX_FORGE_*` caps; no octokit dependency.
|
|
14
|
+
- `createGitAwareRepositoryOperations(cwd, options?)` — ignore-aware enumeration via fixed `git ls-files` with native walker fallback; host-only `includeIgnored`; `DEFAULT_MAX_LS_FILES_OUTPUT_BYTES` / `HARD_MAX_LS_FILES_OUTPUT_BYTES`.
|
|
15
|
+
- `createLanguageIntelligence(options)` — host-selected LSP 3.17 client (Content-Length framing); symbols/definitions/references/diagnostics/hover/rename; lazy spawn; `ERR_PRISM_LSP_*`; frozen `DEFAULT_MAX_LSP_*` / `HARD_MAX_LSP_*` caps.
|
|
16
|
+
- `createProcessSessions(options)` — managed process sessions (start/output/input/wait/signal/kill/release); optional sandbox `startProcess` backend + `reconcile`/sandbox-loss → `unknown`; ownership/identity + expiry sweep; `CodingProcessEvent`; `ERR_PRISM_PROCESS_*`; frozen `DEFAULT_MAX_PROCESS_*` / `HARD_MAX_PROCESS_*` caps; `OutputAccumulator.readRaw` for cursor paging.
|
|
17
|
+
- `CreateGitHubForgeOptions.fetch?` — host-injectable fetch (defaults to `globalThis.fetch`); enables routing forge traffic through an egress proxy and mock-fetch tests.
|
|
18
|
+
|
|
3
19
|
## [0.0.25] - 2026-08-06
|
|
4
20
|
|
|
5
21
|
### Added
|
package/README.md
CHANGED
|
@@ -103,11 +103,11 @@ const askUser = createAskUserDecisionTool({
|
|
|
103
103
|
|
|
104
104
|
### Phase 4 non-goals
|
|
105
105
|
|
|
106
|
-
No PDF reader, trash daemon,
|
|
106
|
+
No PDF reader, trash daemon, or PTY in 0.0.21. Phase 9 optionals: `createLanguageIntelligence`, `createProcessSessions`, `createGitHubForge`. See [coding agent tools docs](https://github.com/ashiqrniloy/prism/blob/main/docs/coding-agent-tools.md), [language intelligence](https://github.com/ashiqrniloy/prism/blob/main/docs/language-intelligence.md), [process sessions](https://github.com/ashiqrniloy/prism/blob/main/docs/process-sessions.md), and [forge integration](https://github.com/ashiqrniloy/prism/blob/main/docs/forge-integration.md).
|
|
107
107
|
|
|
108
108
|
## Exports
|
|
109
109
|
|
|
110
|
-
Factories: `createShellTool`, `createReadTool`, `createWriteTool`, `createEditTool`, `createRepoListTool`, `createRepoSearchTool`, `createGlobTool`, `createDeleteTool`, `createMoveTool`, `createCodingTools`, `createReadOnlyTools`, `createAllTools`, `createGitTools`, `createCodingCheckTool`, `createAskUserDecisionTool`, `createLocalBashOperations`, `createLocalRepositoryOperations`, `createGitOperations`, `createReadPathSet`.
|
|
110
|
+
Factories: `createShellTool`, `createReadTool`, `createWriteTool`, `createEditTool`, `createRepoListTool`, `createRepoSearchTool`, `createGlobTool`, `createDeleteTool`, `createMoveTool`, `createCodingTools`, `createReadOnlyTools`, `createAllTools`, `createGitTools`, `createCodingCheckTool`, `createAskUserDecisionTool`, `createLocalBashOperations`, `createLocalRepositoryOperations`, `createGitAwareRepositoryOperations`, `createLanguageIntelligence`, `createProcessSessions`, `createGitHubForge`, `createGitOperations`, `createReadPathSet`.
|
|
111
111
|
|
|
112
112
|
Helpers: `detectSupportedImageMimeType`, `detectSupportedImageMimeTypeFromFile`, `getShellConfig`, `killProcessTree`, `waitForChildProcess`, `withFileMutationQueue`, `resolveRepositoryLimits`, `matchGlobPattern`, `validateGlobPattern`, `writeCodingPlanFile`, `readCodingPlanFile`, `buildCodingCheckpointMetadata`, `validateCodingCheckpointMetadata`, `assertCodingResumeAllowed`, `fingerprintJson`, `runCodingGoalVerify`, `createCodingGoalVerifyWorkflow`, `suspendAskUserDecision`, `createAskUserDecisionResumeValidator`, `validateAskUserDecisionResume`, `validateAskUserDecisionAgentResume`. Default/hard coding, repository, Git, and plan/checkpoint limit constants are exported for host configuration.
|
|
113
113
|
|
package/dist/delete.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExecutionPolicy, ToolDefinition } from "@arnilo/prism";
|
|
2
|
+
import type { CodingLifecycleEvent } from "./lifecycle.js";
|
|
2
3
|
export interface MutationStat {
|
|
3
4
|
isFile(): boolean;
|
|
4
5
|
isDirectory(): boolean;
|
|
@@ -22,5 +23,7 @@ export interface DeleteOperations {
|
|
|
22
23
|
export interface DeleteToolOptions {
|
|
23
24
|
executionPolicy?: ExecutionPolicy;
|
|
24
25
|
operations?: DeleteOperations;
|
|
26
|
+
/** Optional consumer-gated lifecycle listener (file_changed / permission_denied). */
|
|
27
|
+
onEvent?: (event: CodingLifecycleEvent) => void;
|
|
25
28
|
}
|
|
26
29
|
export declare function createDeleteTool(cwd: string, options?: DeleteToolOptions): ToolDefinition;
|
package/dist/delete.js
CHANGED
|
@@ -62,7 +62,7 @@ export function createDeleteTool(cwd, options) {
|
|
|
62
62
|
paths: [absolutePath],
|
|
63
63
|
risk: "high",
|
|
64
64
|
metadata: { sessionId: context.sessionId, runId: context.runId, signal: context.signal },
|
|
65
|
-
}, toolCallId, "delete");
|
|
65
|
+
}, toolCallId, "delete", (denied) => options?.onEvent?.({ type: "permission_denied", ...denied }));
|
|
66
66
|
if (!policyCheck.allowed)
|
|
67
67
|
return policyCheck.result;
|
|
68
68
|
const allowedPath = policyCheck.action.paths?.[0] ?? absolutePath;
|
|
@@ -84,6 +84,7 @@ export function createDeleteTool(cwd, options) {
|
|
|
84
84
|
return errorResult(toolCallId, "Operation aborted");
|
|
85
85
|
if (st.isFile() || st.isSymbolicLink()) {
|
|
86
86
|
await ops.unlink(allowedPath, { signal: context.signal });
|
|
87
|
+
options?.onEvent?.({ type: "file_changed", path: allowedPath, op: "delete", toolCallId });
|
|
87
88
|
return {
|
|
88
89
|
toolCallId,
|
|
89
90
|
name: "delete",
|
|
@@ -97,6 +98,7 @@ export function createDeleteTool(cwd, options) {
|
|
|
97
98
|
return errorResult(toolCallId, `Directory is not empty: ${path}. Recursive delete is not supported.`);
|
|
98
99
|
}
|
|
99
100
|
await ops.rmdir(allowedPath, { signal: context.signal });
|
|
101
|
+
options?.onEvent?.({ type: "file_changed", path: allowedPath, op: "delete", toolCallId });
|
|
100
102
|
return {
|
|
101
103
|
toolCallId,
|
|
102
104
|
name: "delete",
|
package/dist/edit.d.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { Buffer } from "node:buffer";
|
|
23
23
|
import type { ExecutionPolicy, ToolDefinition } from "@arnilo/prism";
|
|
24
|
+
import type { CodingLifecycleEvent } from "./lifecycle.js";
|
|
24
25
|
import { type ReadBeforeWriteOptions } from "./read-path-set.js";
|
|
25
26
|
export interface Edit {
|
|
26
27
|
oldText: string;
|
|
@@ -71,5 +72,7 @@ export interface EditToolOptions extends ReadBeforeWriteOptions {
|
|
|
71
72
|
maxInputBytes?: number;
|
|
72
73
|
/** Maximum replacements per call (default 100). */
|
|
73
74
|
maxEdits?: number;
|
|
75
|
+
/** Optional consumer-gated lifecycle listener (file_changed / permission_denied). */
|
|
76
|
+
onEvent?: (event: CodingLifecycleEvent) => void;
|
|
74
77
|
}
|
|
75
78
|
export declare function createEditTool(cwd: string, options?: EditToolOptions): ToolDefinition;
|
package/dist/edit.js
CHANGED
|
@@ -149,7 +149,7 @@ export function createEditTool(cwd, options) {
|
|
|
149
149
|
paths: [absolutePath],
|
|
150
150
|
risk: "medium",
|
|
151
151
|
metadata: { editCount: edits.length, sessionId: context.sessionId, runId: context.runId, signal: context.signal },
|
|
152
|
-
}, toolCallId, "edit");
|
|
152
|
+
}, toolCallId, "edit", (denied) => options?.onEvent?.({ type: "permission_denied", ...denied }));
|
|
153
153
|
if (!policyCheck.allowed)
|
|
154
154
|
return policyCheck.result;
|
|
155
155
|
const allowedPath = policyCheck.action.paths?.[0] ?? absolutePath;
|
|
@@ -203,6 +203,7 @@ export function createEditTool(cwd, options) {
|
|
|
203
203
|
return errorResult(toolCallId, "Operation aborted");
|
|
204
204
|
const finalContent = bom + restoreLineEndings(newContent, originalEnding);
|
|
205
205
|
await ops.writeFile(allowedPath, finalContent, { signal: context.signal });
|
|
206
|
+
options?.onEvent?.({ type: "file_changed", path: allowedPath, op: "edit", toolCallId });
|
|
206
207
|
const diffResult = generateDiffString(baseContent, newContent);
|
|
207
208
|
const patch = generateUnifiedPatch(prepared.path, baseContent, newContent);
|
|
208
209
|
return {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ExecutionAction, ExecutionPolicy, ToolResult } from "@arnilo/prism";
|
|
2
|
-
export declare function enforceExecutionPolicy(policy: ExecutionPolicy | undefined, action: ExecutionAction, toolCallId: string, toolName: string
|
|
2
|
+
export declare function enforceExecutionPolicy(policy: ExecutionPolicy | undefined, action: ExecutionAction, toolCallId: string, toolName: string,
|
|
3
|
+
/** Called once on policy denial so one site emits lifecycle permission_denied for every tool. */
|
|
4
|
+
onDenied?: (input: {
|
|
5
|
+
readonly toolCallId: string;
|
|
6
|
+
readonly toolName: string;
|
|
7
|
+
readonly reason: string;
|
|
8
|
+
}) => void): Promise<{
|
|
3
9
|
allowed: true;
|
|
4
10
|
action: ExecutionAction;
|
|
5
11
|
} | {
|
package/dist/execution-policy.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { assertExecutionAllowed, ExecutionDeniedError } from "@arnilo/prism";
|
|
2
|
-
export async function enforceExecutionPolicy(policy, action, toolCallId, toolName
|
|
2
|
+
export async function enforceExecutionPolicy(policy, action, toolCallId, toolName,
|
|
3
|
+
/** Called once on policy denial so one site emits lifecycle permission_denied for every tool. */
|
|
4
|
+
onDenied) {
|
|
3
5
|
if (!policy)
|
|
4
6
|
return { allowed: true, action };
|
|
5
7
|
try {
|
|
@@ -12,6 +14,7 @@ export async function enforceExecutionPolicy(policy, action, toolCallId, toolNam
|
|
|
12
14
|
: error instanceof Error
|
|
13
15
|
? error.message
|
|
14
16
|
: String(error);
|
|
17
|
+
onDenied?.({ toolCallId, toolName, reason: message });
|
|
15
18
|
return {
|
|
16
19
|
allowed: false,
|
|
17
20
|
result: {
|