pi-harness-runtime 1.1.43 → 1.1.44
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/harness/langchain/agents.test.ts +40 -0
- package/harness/langchain/agents.ts +34 -2
- package/harness/langchain/graph.ts +18 -11
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import assert from "node:assert";
|
|
4
|
+
import { isAutonomyRequest } from "./agents.js";
|
|
5
|
+
|
|
6
|
+
describe("isAutonomyRequest", () => {
|
|
7
|
+
const shouldMatch = [
|
|
8
|
+
"You are free to write code until finish without my permission",
|
|
9
|
+
"you are free to write code until finish without permission",
|
|
10
|
+
"free to write code without permission",
|
|
11
|
+
"free to implement until done",
|
|
12
|
+
"free to build until complete",
|
|
13
|
+
"autonomous mode",
|
|
14
|
+
"autonomous",
|
|
15
|
+
"self-directed coding",
|
|
16
|
+
"no need for human approval",
|
|
17
|
+
"no need for confirmation",
|
|
18
|
+
"proceed without my approval",
|
|
19
|
+
"proceed without human",
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const shouldNotMatch = [
|
|
23
|
+
"please review the code",
|
|
24
|
+
"check the output",
|
|
25
|
+
"run tests and report",
|
|
26
|
+
"waiting for human input",
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
for (const text of shouldMatch) {
|
|
30
|
+
it(`matches: "${text.slice(0, 50)}"`, () => {
|
|
31
|
+
assert.ok(isAutonomyRequest(text), `Expected to match: ${text}`);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
for (const text of shouldNotMatch) {
|
|
36
|
+
it(`does NOT match: "${text}"`, () => {
|
|
37
|
+
assert.ok(!isAutonomyRequest(text), `Expected NOT to match: ${text}`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -46,6 +46,40 @@ export const ReviewVerdictSchema = z.object({
|
|
|
46
46
|
|
|
47
47
|
export type ReviewVerdict = z.infer<typeof ReviewVerdictSchema>;
|
|
48
48
|
|
|
49
|
+
// ─── Autonomy Signal Detection ────────────────────────────────────────────
|
|
50
|
+
//
|
|
51
|
+
// When these phrases appear in the user request, the agents activate full
|
|
52
|
+
// autonomous mode: no waiting, no "Next Steps", no confirmation prompts.
|
|
53
|
+
// The directive is injected into every system prompt when a signal is detected.
|
|
54
|
+
//
|
|
55
|
+
// Human says: "You are free to write code until finish without my permission"
|
|
56
|
+
// → Agents interpret this as: autonomy unlocked, write freely
|
|
57
|
+
|
|
58
|
+
const AUTONOMY_SIGNALS = [
|
|
59
|
+
/free to (write|code|implement|build|create)/i,
|
|
60
|
+
/until (finish|complete|done)/i,
|
|
61
|
+
/without (my )?permission/i,
|
|
62
|
+
/\bautonomous(ly)?( mode)?\b/i,
|
|
63
|
+
/self[- ]?directed/i,
|
|
64
|
+
/no (need (to|for)|waiting for) (human|confirmation|approval|permission)/i,
|
|
65
|
+
/proceed without (me|human|my |approval)/i,
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
export function isAutonomyRequest(request: string): boolean {
|
|
69
|
+
return AUTONOMY_SIGNALS.some((re) => re.test(request));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Directive injected into every system prompt when autonomy signal is detected. */
|
|
73
|
+
export function autonomyDirective(): string {
|
|
74
|
+
return `\n\n[AUTONOMY MODE ACTIVE]
|
|
75
|
+
You are operating in full autonomous mode. The human has explicitly granted
|
|
76
|
+
permission to write code until finish without waiting for confirmation.
|
|
77
|
+
- Do NOT ask for permission to proceed
|
|
78
|
+
- Do NOT output "Next Steps" or waiting-for-human signals
|
|
79
|
+
- Do NOT wait for human review — the loop routes automatically
|
|
80
|
+
- Write the code and output the result; the loop handles the rest`;
|
|
81
|
+
}
|
|
82
|
+
|
|
49
83
|
// ─── Prompts ────────────────────────────────────────────────────────────────
|
|
50
84
|
//
|
|
51
85
|
// PROMPTS ARE WRITTEN FOR DAEMON AUDIENCE, NOT HUMAN READERS.
|
|
@@ -57,7 +91,6 @@ export type ReviewVerdict = z.infer<typeof ReviewVerdictSchema>;
|
|
|
57
91
|
// - If stuck, fail with a clear error, do not wait silently
|
|
58
92
|
// - Output is consumed by the loop, not a human reading for guidance
|
|
59
93
|
|
|
60
|
-
|
|
61
94
|
const PLANNER_PROMPT = `You are the Planning Agent (GPT) in an autonomous daemon loop.
|
|
62
95
|
|
|
63
96
|
Given a feature request, produce a concise implementation plan: goals, non-goals,
|
|
@@ -79,7 +112,6 @@ IMPORTANT:
|
|
|
79
112
|
- If you cannot proceed, fail with a clear error message
|
|
80
113
|
- Your output is consumed by the loop, not read by a human for guidance`;
|
|
81
114
|
|
|
82
|
-
|
|
83
115
|
const REVIEWER_PROMPT = `You are the Code Review Agent (GPT) in an autonomous daemon loop.
|
|
84
116
|
|
|
85
117
|
You review the coder's output against the plan. Be strict: request changes only
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
StateGraph,
|
|
21
21
|
} from "@langchain/langgraph";
|
|
22
22
|
import {
|
|
23
|
+
autonomyDirective,
|
|
24
|
+
isAutonomyRequest,
|
|
23
25
|
lastMessage,
|
|
24
26
|
type ReviewVerdict,
|
|
25
27
|
ReviewVerdictSchema,
|
|
@@ -226,6 +228,11 @@ export async function buildRealLoopDeps(
|
|
|
226
228
|
blackboard.init();
|
|
227
229
|
}
|
|
228
230
|
|
|
231
|
+
// Autonomy mode: computed inside plan(), stored for write()/review()
|
|
232
|
+
const _autonomous = false;
|
|
233
|
+
const _directive = "";
|
|
234
|
+
|
|
235
|
+
|
|
229
236
|
/** Inject scoreboard markdown into a user message. */
|
|
230
237
|
const withScoreboard = (msg: string) => {
|
|
231
238
|
const scoreboard = blackboard.toMarkdown();
|
|
@@ -259,8 +266,9 @@ export async function buildRealLoopDeps(
|
|
|
259
266
|
}
|
|
260
267
|
if (state.review?.comments && state.review.comments.length > 0) {
|
|
261
268
|
blackboard.setChangesRequested(
|
|
262
|
-
state.review.comments.map(
|
|
263
|
-
|
|
269
|
+
state.review.comments.map(
|
|
270
|
+
(c) =>
|
|
271
|
+
`[${c.severity ?? "minor"}] ${c.file ? `${c.file}: ` : ""}${c.comment}`,
|
|
264
272
|
),
|
|
265
273
|
);
|
|
266
274
|
}
|
|
@@ -270,13 +278,13 @@ export async function buildRealLoopDeps(
|
|
|
270
278
|
}
|
|
271
279
|
};
|
|
272
280
|
|
|
273
|
-
|
|
281
|
+
return {
|
|
274
282
|
maxIterations: options.maxIterations ?? 3,
|
|
275
283
|
onStep,
|
|
276
284
|
plan: async (request) =>
|
|
277
285
|
lastMessage(
|
|
278
286
|
await planner.invoke({
|
|
279
|
-
messages: [{ role: "user", content: withScoreboard(request) }],
|
|
287
|
+
messages: [{ role: "user", content: _directive + withScoreboard(request) }],
|
|
280
288
|
}),
|
|
281
289
|
),
|
|
282
290
|
write: async (plan, review) => {
|
|
@@ -287,7 +295,7 @@ export async function buildRealLoopDeps(
|
|
|
287
295
|
: `## Plan\n${plan}`;
|
|
288
296
|
return lastMessage(
|
|
289
297
|
await coder.invoke({
|
|
290
|
-
messages: [{ role: "user", content: withScoreboard(userMsg) }],
|
|
298
|
+
messages: [{ role: "user", content: _directive + withScoreboard(userMsg) }],
|
|
291
299
|
}),
|
|
292
300
|
);
|
|
293
301
|
},
|
|
@@ -296,9 +304,7 @@ export async function buildRealLoopDeps(
|
|
|
296
304
|
messages: [
|
|
297
305
|
{
|
|
298
306
|
role: "user",
|
|
299
|
-
content: withScoreboard(
|
|
300
|
-
`## Plan\n${plan}\n\n## Code to review\n${code}`,
|
|
301
|
-
),
|
|
307
|
+
content: _directive + withScoreboard(`## Plan\n${plan}\n\n## Code to review\n${code}`),
|
|
302
308
|
},
|
|
303
309
|
],
|
|
304
310
|
});
|
|
@@ -367,8 +373,9 @@ export function buildDryRunDeps(
|
|
|
367
373
|
if (verdict) blackboard.setVerdict(verdict, state.review?.summary);
|
|
368
374
|
if (state.review?.comments && state.review.comments.length > 0) {
|
|
369
375
|
blackboard.setChangesRequested(
|
|
370
|
-
state.review.comments.map(
|
|
371
|
-
|
|
376
|
+
state.review.comments.map(
|
|
377
|
+
(c) =>
|
|
378
|
+
`[${c.severity ?? "minor"}] ${c.file ? `${c.file}: ` : ""}${c.comment}`,
|
|
372
379
|
),
|
|
373
380
|
);
|
|
374
381
|
}
|
|
@@ -378,7 +385,7 @@ export function buildDryRunDeps(
|
|
|
378
385
|
}
|
|
379
386
|
};
|
|
380
387
|
|
|
381
|
-
|
|
388
|
+
return {
|
|
382
389
|
maxIterations: options.maxIterations ?? 3,
|
|
383
390
|
onStep,
|
|
384
391
|
plan: async (request) =>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/capability-registry",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.44",
|
|
4
4
|
"description": "Capability Registry for pi-harness-runtime — tracks model capabilities and enables capability-based routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/provider-router",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.44",
|
|
4
4
|
"description": "Enhanced Provider Router for pi-harness-runtime — intelligent routing with capabilities, costs, and quotas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/provider-router.js",
|