@awak-app/simy-cli 0.7.27 → 0.7.29
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/package.json +3 -3
- package/src/cli-contract.js +1 -1
- package/src/cli-observability.js +1 -1
- package/src/codex-plugins/simy/hooks/delivery-loop.mjs +229 -22
- package/src/codex-plugins/simy/hooks/purpose-search.mjs +23 -4
- package/src/codex-plugins/simy/hooks/result-cycle.mjs +8 -1
- package/src/codex-plugins/simy/hooks/scene-reasoning.mjs +2 -0
- package/src/delivery-hooks/command.js +4 -0
- package/src/delivery-hooks/lifecycle-recovery.js +1 -1
- package/src/delivery-hooks/supervisor.js +14 -2
- package/src/desktop-executor.js +6 -0
- package/src/orchestrator/budget.js +24 -0
- package/src/orchestrator/charter-repair.js +1 -1
- package/src/orchestrator/independent-audit.js +13 -6
- package/src/orchestrator/loop.js +34 -4
- package/src/provider-stream.js +9 -2
- package/src/runner.js +42 -20
- package/src/session-supervision/automatic-continuation.js +8 -1
- package/src/session-supervision/claude-outcome-review.js +132 -0
- package/src/session-supervision/claude-review-definition.js +5 -0
- package/src/session-supervision/claude-sessions.js +67 -6
- package/src/session-supervision/codex-app-server.js +170 -35
- package/src/session-supervision/codex-native-connection.js +101 -0
- package/src/session-supervision/continuation-analysis.js +1 -1
- package/src/session-supervision/index.js +5 -2
- package/src/session-supervision/native-handoff.js +251 -0
- package/src/session-supervision/purpose-recovery.js +1 -0
- package/src/session-supervision/purpose-verification.js +103 -9
- package/src/sqm/agent-skill.js +3 -1
- package/src/sqm/claude-plugin.js +2 -0
- package/src/sqm/command.js +17 -1
- package/src/sqm/hypothesis-knowledge.js +31 -10
- package/src/sqm/knowledge-recall.js +66 -0
- package/src/sqm/review-worker.js +3 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isAdvisoryGuidance } from './advisory-guidance.js';
|
|
2
|
+
// Reasoning context only. Selection never enables, disables or certifies checks.
|
|
3
|
+
const MAX_CONTEXT_CHARACTERS = 48_000;
|
|
4
|
+
const MAX_QUERY_CHARACTERS = 12_000;
|
|
5
|
+
const PAGE_SIZE = 20;
|
|
6
|
+
|
|
7
|
+
function terms(value) {
|
|
8
|
+
const text = String(value).normalize('NFKC').toLowerCase();
|
|
9
|
+
const result = new Set(text.match(/[\p{L}\p{N}_-]{2,}/gu) || []);
|
|
10
|
+
for (const [run] of text.matchAll(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+/gu)) {
|
|
11
|
+
for (let i = 0; i + 1 < run.length; i++) result.add(run.slice(i, i + 2));
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function selectReasoningKnowledge(bundle, repository, { query = '', offset = 0 } = {}) {
|
|
17
|
+
if (!Number.isSafeInteger(offset) || offset < 0) throw new TypeError('Knowledge offset must be a nonnegative integer');
|
|
18
|
+
const target = repository.toLowerCase();
|
|
19
|
+
const scope = bundle.system_scope;
|
|
20
|
+
const repositories = scope?.repository?.toLowerCase() === target
|
|
21
|
+
? scope.repositories.map(repo => repo.toLowerCase()) : [target];
|
|
22
|
+
const queryText = String(query).slice(0, MAX_QUERY_CHARACTERS);
|
|
23
|
+
const queryTerms = terms(queryText);
|
|
24
|
+
const eligible = bundle.modules.filter(module => !isAdvisoryGuidance(module) &&
|
|
25
|
+
!['candidate', 'retired'].includes(module.lifecycle.status) &&
|
|
26
|
+
(!module.scope.repositories?.length || module.scope.repositories.some(repo => repositories.includes(repo.toLowerCase()))));
|
|
27
|
+
const scored = eligible.map(module => {
|
|
28
|
+
// Keep all bounded invariant fields together, particularly applicability and
|
|
29
|
+
// counter-evidence. A short title alone cannot support causal transfer.
|
|
30
|
+
const context = {
|
|
31
|
+
moduleId: module.id, version: module.version, title: module.title,
|
|
32
|
+
invariant: module.invariant.statement, failureCondition: module.invariant.failure_condition || null,
|
|
33
|
+
remediation: module.invariant.remediation || null,
|
|
34
|
+
scope: module.scope, lifecycle: module.lifecycle.status,
|
|
35
|
+
ruleCount: module.detection.checks.length, scenarioDefinitionCount: module.assurance?.scenarios?.length || 0,
|
|
36
|
+
incidentRefs: module.incident_refs,
|
|
37
|
+
transferStatus: module.scope.repositories?.some(repo => repo.toLowerCase() === target) || !module.scope.repositories?.length
|
|
38
|
+
? 'target_not_evaluated' : 'cross_repository_hypothesis',
|
|
39
|
+
};
|
|
40
|
+
const vocabulary = terms(JSON.stringify(context));
|
|
41
|
+
const score = [...queryTerms].filter(term => vocabulary.has(term)).length;
|
|
42
|
+
return { context, score };
|
|
43
|
+
}).sort((a, b) => b.score - a.score || a.context.moduleId.localeCompare(b.context.moduleId) || a.context.version.localeCompare(b.context.version));
|
|
44
|
+
const matches = queryTerms.size ? scored.filter(item => item.score > 0) : scored;
|
|
45
|
+
const modules = []; let characters = 0; let consumed = 0; let oversizedCount = 0;
|
|
46
|
+
for (const item of matches.slice(offset, offset + PAGE_SIZE)) {
|
|
47
|
+
const size = JSON.stringify(item.context).length;
|
|
48
|
+
if (size > MAX_CONTEXT_CHARACTERS) { consumed++; oversizedCount++; continue; }
|
|
49
|
+
if (characters + size > MAX_CONTEXT_CHARACTERS) break;
|
|
50
|
+
modules.push(item.context); characters += size; consumed++;
|
|
51
|
+
}
|
|
52
|
+
const next = offset + consumed;
|
|
53
|
+
return {
|
|
54
|
+
modules, availableCount: eligible.length, matchedCount: matches.length,
|
|
55
|
+
omittedCount: eligible.length - modules.length,
|
|
56
|
+
nextOffset: next < matches.length && consumed ? next : null,
|
|
57
|
+
retrieval: { policyVersion: 'sqm-reasoning-recall.v3', mode: 'unicode_lexical',
|
|
58
|
+
queryTruncated: String(query).length > queryText.length, contextCharacters: characters,
|
|
59
|
+
oversizedCount,
|
|
60
|
+
incomplete: matches.length > modules.length || queryText.length < String(query).length,
|
|
61
|
+
outcome: modules.length ? 'matched' : matches.length ? 'page_omitted' : queryTerms.size ? 'no_lexical_match' : 'empty_catalog',
|
|
62
|
+
executedTests: 0 },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const KNOWLEDGE_TRANSFER_INSTRUCTION = `Before selecting historical knowledge, reason from the current change to plausible failure mechanisms and downstream effects. Trace callers, data scale, per-operation cost, invocation frequency, concurrency, retries and shared resource capacity. The first retrieved page is not the boundary of your reasoning. Form additional mechanism queries in your own words and use the supplied search command to retrieve more context when useful. For example a changed query or polling path can warrant checking repeated scans and disk I/O saturation even without those words in the diff; inspect plans, indexes, scale and workload before claiming a defect. For each useful analogy consider applicability, counter-evidence and missing evidence. A bounded indexed query can be safe. Historical incidents and retrieval hypotheses are not observations about this candidate; knowledge scope is not executable rule authority. Empty, omitted or unavailable knowledge does not establish safety or coverage. Keep unverified runtime assumptions explicit.`;
|
package/src/sqm/review-worker.js
CHANGED
|
@@ -23,8 +23,9 @@ const RECOVERABLE_PROVIDER_FAILURES = new Set([
|
|
|
23
23
|
]);
|
|
24
24
|
const isRecoverableProviderFailure = failure => ["analysis", "adjudication"].includes(failure.stage) && RECOVERABLE_PROVIDER_FAILURES.has(failure.code);
|
|
25
25
|
const DEFAULT_LEASE_SECONDS = 300;
|
|
26
|
-
// Claim can
|
|
27
|
-
|
|
26
|
+
// Claim can freeze source evidence (45s) and scoped knowledge recall (90s).
|
|
27
|
+
// Stay outside the Web upstream (150s) and legacy relay (165s) budgets.
|
|
28
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 180_000;
|
|
28
29
|
const DEFAULT_EXECUTION_TIMEOUT_MS = 360_000;
|
|
29
30
|
const CODEX_ATTEMPT_TIMEOUT_MS = 180_000;
|
|
30
31
|
const MIN_STALL_RETRY_MS = 60_000;
|