snipara-companion 3.2.4 → 3.2.6
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/dist/index.d.ts +4 -1
- package/dist/index.js +82 -27
- package/docs/FULL_REFERENCE.md +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1440,6 +1440,7 @@ interface MemoryGuardCheckOptions {
|
|
|
1440
1440
|
confirmedByUser?: string;
|
|
1441
1441
|
strict?: boolean;
|
|
1442
1442
|
json?: boolean;
|
|
1443
|
+
verbose?: boolean;
|
|
1443
1444
|
limit?: number;
|
|
1444
1445
|
categories?: string[];
|
|
1445
1446
|
includeContext?: boolean;
|
|
@@ -3385,6 +3386,7 @@ declare function buildWorkflowPhaseCommitSummary(args: {
|
|
|
3385
3386
|
phase: Pick<ManagedWorkflowPhase, "id" | "title">;
|
|
3386
3387
|
summary: string;
|
|
3387
3388
|
}): string;
|
|
3389
|
+
declare function resolveAutoWorkflowMode(query: string): Exclude<WorkflowMode, "auto">;
|
|
3388
3390
|
/**
|
|
3389
3391
|
* Compute the impact gate for committed-but-unpushed workflow phases.
|
|
3390
3392
|
*
|
|
@@ -3869,6 +3871,7 @@ interface CollaborationCommandOptions {
|
|
|
3869
3871
|
ackReviewOnly?: boolean;
|
|
3870
3872
|
dir?: string;
|
|
3871
3873
|
json?: boolean;
|
|
3874
|
+
verbose?: boolean;
|
|
3872
3875
|
}
|
|
3873
3876
|
interface CollaborationHooksInstallOptions {
|
|
3874
3877
|
dir?: string;
|
|
@@ -4255,4 +4258,4 @@ declare function buildOrchestratorHandoff(options: OrchestratorHandoffOptions):
|
|
|
4255
4258
|
declare function buildAdaptiveWorkRoutingRecommendation(options: AdaptiveWorkRoutingOptions): AdaptiveWorkRoutingRecommendation;
|
|
4256
4259
|
declare function writeOrchestratorHandoff(options: OrchestratorHandoffOptions): WrittenOrchestratorHandoff;
|
|
4257
4260
|
|
|
4258
|
-
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, CODING_INTELLIGENCE_LEDGER_VERSION, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, PRODUCER_LOOP_ARTIFACT_VERSION, PRODUCER_LOOP_RELATIVE_DIR, PRODUCER_LOOP_REPORT_VERSION, TEAM_SYNC_STATE_RELATIVE_PATH, WHY_OUTCOME_CAPTURE_VERSION, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, addLocalWorker, agentReadinessAuditCommand, appendActivityEvent, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCodingIntelligenceLedger, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalProjectRealityCheck, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProducerLoopReport, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapQuality, buildSessionSnapshot, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWhyOutcomeCaptureReport, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, cleanContextPacks, codingLedgerExportCommand, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, memoryReviewsCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, outcomeCapturePreviewCommand, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readActivityTimeline, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, readLocalWorkersConfig, readSessionSnapshot, realityCheckCommand, referencesIngestCommand, referencesScanCommand, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveLocalWorkerRoutingDefaults, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, workersLocalAddCommand, workersLocalListCommand, workersLocalProbePrintCommand, workersLocalRemoveCommand, workersLocalStatusCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff, writeProducerLoopArtifact, writeSessionSnapshot };
|
|
4261
|
+
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, CODING_INTELLIGENCE_LEDGER_VERSION, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, PRODUCER_LOOP_ARTIFACT_VERSION, PRODUCER_LOOP_RELATIVE_DIR, PRODUCER_LOOP_REPORT_VERSION, TEAM_SYNC_STATE_RELATIVE_PATH, WHY_OUTCOME_CAPTURE_VERSION, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, addLocalWorker, agentReadinessAuditCommand, appendActivityEvent, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCodingIntelligenceLedger, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalProjectRealityCheck, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProducerLoopReport, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapQuality, buildSessionSnapshot, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWhyOutcomeCaptureReport, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, cleanContextPacks, codingLedgerExportCommand, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, memoryReviewsCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, outcomeCapturePreviewCommand, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readActivityTimeline, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, readLocalWorkersConfig, readSessionSnapshot, realityCheckCommand, referencesIngestCommand, referencesScanCommand, resolveAutoWorkflowMode, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveLocalWorkerRoutingDefaults, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, workersLocalAddCommand, workersLocalListCommand, workersLocalProbePrintCommand, workersLocalRemoveCommand, workersLocalStatusCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff, writeProducerLoopArtifact, writeSessionSnapshot };
|
package/dist/index.js
CHANGED
|
@@ -192,6 +192,7 @@ __export(index_exports, {
|
|
|
192
192
|
realityCheckCommand: () => realityCheckCommand,
|
|
193
193
|
referencesIngestCommand: () => referencesIngestCommand,
|
|
194
194
|
referencesScanCommand: () => referencesScanCommand,
|
|
195
|
+
resolveAutoWorkflowMode: () => resolveAutoWorkflowMode,
|
|
195
196
|
resolveContextPackRecord: () => resolveContextPackRecord,
|
|
196
197
|
resolveFullWorkflowTokenBudget: () => resolveFullWorkflowTokenBudget,
|
|
197
198
|
resolveLocalWorkerRoutingDefaults: () => resolveLocalWorkerRoutingDefaults,
|
|
@@ -8361,6 +8362,9 @@ function printMemoryGuardResult(result) {
|
|
|
8361
8362
|
}
|
|
8362
8363
|
}
|
|
8363
8364
|
}
|
|
8365
|
+
function shouldPrintCompactMemoryGuardSuccess(result, options) {
|
|
8366
|
+
return !options.verbose && result.triggered && !result.shouldBlock && !result.requiresConfirmation && result.contradictions.length === 0 && result.recentFailures.length === 0 && result.warnings.length === 0;
|
|
8367
|
+
}
|
|
8364
8368
|
async function runMemoryGuardCheck(options = {}) {
|
|
8365
8369
|
const cwd = process.env.SNIPARA_WORKSPACE_DIR || process.cwd();
|
|
8366
8370
|
const root = findWorkspaceRoot(cwd, true) || cwd;
|
|
@@ -8572,6 +8576,8 @@ async function memoryGuardCheckCommand(options) {
|
|
|
8572
8576
|
const result = await runMemoryGuardCheck(options);
|
|
8573
8577
|
if (options.json) {
|
|
8574
8578
|
console.log(JSON.stringify(result, null, 2));
|
|
8579
|
+
} else if (shouldPrintCompactMemoryGuardSuccess(result, options)) {
|
|
8580
|
+
console.log(`Snipara Memory Guard: checked (${result.trigger})`);
|
|
8575
8581
|
} else if (result.triggered || options.trigger === "manual") {
|
|
8576
8582
|
printMemoryGuardResult(result);
|
|
8577
8583
|
}
|
|
@@ -12461,7 +12467,7 @@ function printDoctorReport(report, companionVersion, auth, toolCatalog) {
|
|
|
12461
12467
|
"- This doctor confirms local auth and hosted reachability; it does not prove how a specific agent UI ranked or exposed tools."
|
|
12462
12468
|
);
|
|
12463
12469
|
console.log(
|
|
12464
|
-
"-
|
|
12470
|
+
"- A lean Snipara tool set is expected in normal agent sessions. Use snipara_help(query=...) for routed guidance and snipara_help(list_all=true) to inspect specialist opt-in surfaces."
|
|
12465
12471
|
);
|
|
12466
12472
|
if (toolCatalog.available && toolCatalog.htaskToolCount) {
|
|
12467
12473
|
console.log(
|
|
@@ -18868,11 +18874,30 @@ function shellQuote2(value) {
|
|
|
18868
18874
|
function phaseQuery(state, phase) {
|
|
18869
18875
|
return phase.query || `${state.goal}: ${phase.title}`;
|
|
18870
18876
|
}
|
|
18871
|
-
function
|
|
18872
|
-
|
|
18877
|
+
function resolveAutoWorkflowMode(query) {
|
|
18878
|
+
const normalized = query.toLowerCase();
|
|
18879
|
+
if (/\b(orchestrate|swarm|htask|handoff|multi-agent|multi agent|worker|proof gate|proof-gate|drift check|release gate|production gate)\b/.test(
|
|
18880
|
+
normalized
|
|
18881
|
+
)) {
|
|
18882
|
+
return "orchestrate";
|
|
18883
|
+
}
|
|
18884
|
+
if (/\b(deploy|deployment|release|merge|push|migration|schema|auth|billing|security|architecture|architectural|multi-phase|multiphase|phase commit|final commit|managed workflow|roadmap|plan)\b/.test(
|
|
18885
|
+
normalized
|
|
18886
|
+
)) {
|
|
18887
|
+
return "full";
|
|
18888
|
+
}
|
|
18889
|
+
if (/\b(status|show|list|read|lookup|recall|brief|summarize|summary|what changed|question|docs?|documentation)\b/.test(
|
|
18890
|
+
normalized
|
|
18891
|
+
) && !/\b(implement|change|fix|ship|code|refactor|test|write|create|build)\b/.test(normalized)) {
|
|
18892
|
+
return "lite";
|
|
18893
|
+
}
|
|
18894
|
+
return "standard";
|
|
18895
|
+
}
|
|
18896
|
+
function effectiveWorkflowMode(mode, query = "") {
|
|
18897
|
+
return mode === "auto" ? resolveAutoWorkflowMode(query) : mode;
|
|
18873
18898
|
}
|
|
18874
|
-
function shouldFollowWorkflowRecommendations(mode) {
|
|
18875
|
-
const effectiveMode = effectiveWorkflowMode(mode);
|
|
18899
|
+
function shouldFollowWorkflowRecommendations(mode, query = "") {
|
|
18900
|
+
const effectiveMode = effectiveWorkflowMode(mode, query);
|
|
18876
18901
|
return effectiveMode === "standard" || effectiveMode === "full";
|
|
18877
18902
|
}
|
|
18878
18903
|
function printManagedWorkflowState(state) {
|
|
@@ -18917,7 +18942,7 @@ function printManagedWorkflowDiscipline() {
|
|
|
18917
18942
|
"- LITE: small single-phase edits still start with Snipara recall/context and end with local verification."
|
|
18918
18943
|
);
|
|
18919
18944
|
console.log(
|
|
18920
|
-
"- STANDARD: normal coding work uses context plus recommended code-graph follow-up; --mode auto
|
|
18945
|
+
"- STANDARD: normal coding work uses context plus recommended code-graph follow-up; --mode auto deterministically selects lite/standard/full/orchestrate from task intent."
|
|
18921
18946
|
);
|
|
18922
18947
|
console.log(
|
|
18923
18948
|
"- FULL: use this managed workflow with phases/chunks for multi-file, risky, release/deploy, architectural, or compaction-prone coding work."
|
|
@@ -22043,7 +22068,8 @@ async function workflowRunCommand(options) {
|
|
|
22043
22068
|
routingOptions,
|
|
22044
22069
|
adaptiveRoutingWithCatalog
|
|
22045
22070
|
) ? enrichAdaptiveRoutingWithLocalOrchestrator(adaptiveRoutingWithCatalog, routingOptions) : adaptiveRoutingWithCatalog;
|
|
22046
|
-
const
|
|
22071
|
+
const effectiveMode = effectiveWorkflowMode(options.mode, options.query);
|
|
22072
|
+
const orchestratorRecommendation = getOrchestratorRecommendation(options.query, effectiveMode, {
|
|
22047
22073
|
policyAutoRoute: options.autoRouteOrchestrator,
|
|
22048
22074
|
policySource: options.orchestratorPolicySource,
|
|
22049
22075
|
adaptiveRoutingDryRun: Boolean(adaptiveRouting)
|
|
@@ -22055,13 +22081,13 @@ async function workflowRunCommand(options) {
|
|
|
22055
22081
|
query: options.query,
|
|
22056
22082
|
summary: options.query,
|
|
22057
22083
|
title: options.query,
|
|
22058
|
-
mode:
|
|
22084
|
+
mode: effectiveMode,
|
|
22059
22085
|
adaptiveRouting
|
|
22060
22086
|
}) : null;
|
|
22061
22087
|
if (!hostedConfigured) {
|
|
22062
22088
|
const payload2 = {
|
|
22063
22089
|
mode: options.mode,
|
|
22064
|
-
effective_mode:
|
|
22090
|
+
effective_mode: effectiveMode,
|
|
22065
22091
|
local_only: true,
|
|
22066
22092
|
local_policy_path: localAdaptiveRoutingPolicy ? ADAPTIVE_ROUTING_POLICY_RELATIVE_PATH2 : null,
|
|
22067
22093
|
orchestrator_recommendation: orchestratorRecommendation,
|
|
@@ -22091,7 +22117,7 @@ async function workflowRunCommand(options) {
|
|
|
22091
22117
|
if (!client) {
|
|
22092
22118
|
throw new Error("Hosted Snipara client unavailable after configuration check.");
|
|
22093
22119
|
}
|
|
22094
|
-
if (
|
|
22120
|
+
if (effectiveMode === "orchestrate") {
|
|
22095
22121
|
const result = await client.orchestrate(options.query, options.maxTokens);
|
|
22096
22122
|
if (options.json) {
|
|
22097
22123
|
printJson2({
|
|
@@ -22106,8 +22132,8 @@ async function workflowRunCommand(options) {
|
|
|
22106
22132
|
}
|
|
22107
22133
|
printOrchestrateResult(result);
|
|
22108
22134
|
if (options.runtimeHint !== false) {
|
|
22109
|
-
printRuntimeHint(options.query,
|
|
22110
|
-
printOrchestratorHandoffHint(options.query,
|
|
22135
|
+
printRuntimeHint(options.query, effectiveMode);
|
|
22136
|
+
printOrchestratorHandoffHint(options.query, effectiveMode, orchestratorRecommendation);
|
|
22111
22137
|
}
|
|
22112
22138
|
if (adaptiveRouting) {
|
|
22113
22139
|
printAdaptiveRoutingRecommendation(adaptiveRouting);
|
|
@@ -22117,8 +22143,7 @@ async function workflowRunCommand(options) {
|
|
|
22117
22143
|
}
|
|
22118
22144
|
return;
|
|
22119
22145
|
}
|
|
22120
|
-
const
|
|
22121
|
-
const shouldRequestSharedContext = shouldFollowWorkflowRecommendations(options.mode) && hasSharedContextIntent(options.query);
|
|
22146
|
+
const shouldRequestSharedContext = shouldFollowWorkflowRecommendations(options.mode, options.query) && hasSharedContextIntent(options.query);
|
|
22122
22147
|
const workflowBudget = effectiveMode === "full" ? resolveFullWorkflowTokenBudget({
|
|
22123
22148
|
maxTokens: options.maxTokens,
|
|
22124
22149
|
includeSessionContext: options.includeSessionContext,
|
|
@@ -22162,7 +22187,7 @@ async function workflowRunCommand(options) {
|
|
|
22162
22187
|
includeContent: true
|
|
22163
22188
|
});
|
|
22164
22189
|
}
|
|
22165
|
-
if (context.recommended_tool && shouldFollowWorkflowRecommendations(options.mode)) {
|
|
22190
|
+
if (context.recommended_tool && shouldFollowWorkflowRecommendations(options.mode, options.query)) {
|
|
22166
22191
|
payload.executed_recommended_tool = await runRecommendedTool(context);
|
|
22167
22192
|
}
|
|
22168
22193
|
if (effectiveMode === "full") {
|
|
@@ -22256,8 +22281,8 @@ async function workflowRunCommand(options) {
|
|
|
22256
22281
|
printManagedWorkflowStarted(payload.managed_workflow);
|
|
22257
22282
|
}
|
|
22258
22283
|
if (options.runtimeHint !== false) {
|
|
22259
|
-
printRuntimeHint(options.query,
|
|
22260
|
-
printOrchestratorHandoffHint(options.query,
|
|
22284
|
+
printRuntimeHint(options.query, effectiveMode);
|
|
22285
|
+
printOrchestratorHandoffHint(options.query, effectiveMode, orchestratorRecommendation);
|
|
22261
22286
|
}
|
|
22262
22287
|
if (adaptiveRouting) {
|
|
22263
22288
|
printAdaptiveRoutingRecommendation(adaptiveRouting);
|
|
@@ -29794,6 +29819,11 @@ var HOSTED_GUARD_MAX_FILES = 450;
|
|
|
29794
29819
|
var HOSTED_GUARD_MAX_RESOURCES = 850;
|
|
29795
29820
|
var HOSTED_GUARD_MAX_SYMBOL_RESOURCES = 160;
|
|
29796
29821
|
var HOOK_BLOCK_PREFIX2 = "snipara:collaboration-guard";
|
|
29822
|
+
var CHECKOUT_GIT_WRITE_RESOURCE = {
|
|
29823
|
+
kind: "SURFACE",
|
|
29824
|
+
id: "checkout-git-write",
|
|
29825
|
+
label: "Checkout git write access"
|
|
29826
|
+
};
|
|
29797
29827
|
var CRITICAL_SURFACES = [
|
|
29798
29828
|
{
|
|
29799
29829
|
id: "auth",
|
|
@@ -30040,7 +30070,8 @@ async function collaborationStartCommand(options) {
|
|
|
30040
30070
|
state,
|
|
30041
30071
|
hosted
|
|
30042
30072
|
},
|
|
30043
|
-
options.json
|
|
30073
|
+
options.json,
|
|
30074
|
+
options.verbose
|
|
30044
30075
|
);
|
|
30045
30076
|
}
|
|
30046
30077
|
async function collaborationClaimCommand(options) {
|
|
@@ -30082,7 +30113,8 @@ async function collaborationClaimCommand(options) {
|
|
|
30082
30113
|
state,
|
|
30083
30114
|
hosted
|
|
30084
30115
|
},
|
|
30085
|
-
options.json
|
|
30116
|
+
options.json,
|
|
30117
|
+
options.verbose
|
|
30086
30118
|
);
|
|
30087
30119
|
}
|
|
30088
30120
|
async function collaborationGuardCommand(options) {
|
|
@@ -30140,7 +30172,8 @@ async function collaborationGuardCommand(options) {
|
|
|
30140
30172
|
failed: guardFailed
|
|
30141
30173
|
}
|
|
30142
30174
|
},
|
|
30143
|
-
options.json
|
|
30175
|
+
options.json,
|
|
30176
|
+
options.verbose
|
|
30144
30177
|
);
|
|
30145
30178
|
}
|
|
30146
30179
|
function buildCollaborationHooksInstallPlan(options = {}) {
|
|
@@ -30647,6 +30680,9 @@ function resolveRepoRoot3(cwd) {
|
|
|
30647
30680
|
}
|
|
30648
30681
|
function deriveGuardProfileResources(profile, files) {
|
|
30649
30682
|
const resources = [];
|
|
30683
|
+
if (profile === "pre-commit" || profile === "pre-push") {
|
|
30684
|
+
resources.push(CHECKOUT_GIT_WRITE_RESOURCE);
|
|
30685
|
+
}
|
|
30650
30686
|
if (profile === "pre-deploy") {
|
|
30651
30687
|
resources.push(
|
|
30652
30688
|
{ kind: "DEPLOY", id: "production-deployment", label: "Production deployment" },
|
|
@@ -30861,11 +30897,12 @@ function buildCollaborationGitHookBlock(hookName) {
|
|
|
30861
30897
|
const profile = hookName === "pre-push" ? "pre-push" : "pre-commit";
|
|
30862
30898
|
return [
|
|
30863
30899
|
collaborationHookBlockMarker(hookName, "start"),
|
|
30864
|
-
"#
|
|
30900
|
+
"# Atomically claim checkout git writes, then block unsafe parallel edits.",
|
|
30865
30901
|
'if [ "${SNIPARA_COLLABORATION_GUARD:-1}" = "0" ]; then',
|
|
30866
30902
|
' echo "Snipara collaboration guard bypassed by SNIPARA_COLLABORATION_GUARD=0" >&2',
|
|
30867
30903
|
"elif command -v snipara-companion >/dev/null 2>&1; then",
|
|
30868
|
-
` snipara-companion collaboration
|
|
30904
|
+
` snipara-companion collaboration claim --resource SURFACE:checkout-git-write --mode EXCLUSIVE --ttl-seconds 300 --reason "${profile} git write" --json >/dev/null`,
|
|
30905
|
+
` snipara-companion collaboration guard --profile ${profile} --action ${profile} --resource SURFACE:checkout-git-write --enforce --json >/dev/null`,
|
|
30869
30906
|
"else",
|
|
30870
30907
|
' echo "snipara-companion is required for the Snipara collaboration guard. Install it or set SNIPARA_COLLABORATION_GUARD=0 for an explicit emergency bypass." >&2',
|
|
30871
30908
|
" exit 1",
|
|
@@ -30951,7 +30988,7 @@ function resolveReleaseLeaseIds(state, options) {
|
|
|
30951
30988
|
}
|
|
30952
30989
|
throw new Error("No collaboration lease id provided and no active local lease was found");
|
|
30953
30990
|
}
|
|
30954
|
-
function printCollaborationResult(payload, json) {
|
|
30991
|
+
function printCollaborationResult(payload, json, verbose) {
|
|
30955
30992
|
if (json) {
|
|
30956
30993
|
console.log(JSON.stringify(payload, null, 2));
|
|
30957
30994
|
return;
|
|
@@ -30959,6 +30996,10 @@ function printCollaborationResult(payload, json) {
|
|
|
30959
30996
|
const action = String(payload.action ?? "status");
|
|
30960
30997
|
const state = payload.state;
|
|
30961
30998
|
const hosted = payload.hosted;
|
|
30999
|
+
if (!verbose && action === "guard" && isQuietCollaborationGuardSuccess(payload, hosted)) {
|
|
31000
|
+
console.log("Collaboration guard: go");
|
|
31001
|
+
return;
|
|
31002
|
+
}
|
|
30962
31003
|
console.log(getCollaborationHeading(action));
|
|
30963
31004
|
console.log(`State: ${payload.statePath}`);
|
|
30964
31005
|
console.log(`Work session: ${state.workSessionId ?? "none"}`);
|
|
@@ -30986,6 +31027,17 @@ function printCollaborationResult(payload, json) {
|
|
|
30986
31027
|
printGuardActionCards(payload.actionCards);
|
|
30987
31028
|
}
|
|
30988
31029
|
}
|
|
31030
|
+
function isQuietCollaborationGuardSuccess(payload, hosted) {
|
|
31031
|
+
const guard = hosted?.status === "ok" ? hosted.data : void 0;
|
|
31032
|
+
if (!guard || guard.evaluation.decision !== "CLEAR") {
|
|
31033
|
+
return false;
|
|
31034
|
+
}
|
|
31035
|
+
if (guard.evaluation.conflicts.length > 0 || guard.evaluation.recommendedActions.length > 0) {
|
|
31036
|
+
return false;
|
|
31037
|
+
}
|
|
31038
|
+
const actionCards = payload.actionCards;
|
|
31039
|
+
return !actionCards || actionCards.length === 0;
|
|
31040
|
+
}
|
|
30989
31041
|
function printHostedCollaboration(action, data) {
|
|
30990
31042
|
if (!data) {
|
|
30991
31043
|
return;
|
|
@@ -32051,7 +32103,7 @@ program.command("memory-guard").description(
|
|
|
32051
32103
|
new import_commander.Command("check").description("Check whether memory/context guidance is required before continuing").option("--trigger <trigger>", "failure|pre-commit|commit|pre-final|manual", "manual").option("--file <file>", "Touched file").option("--files <files...>", "Touched files").option("--staged", "Use git staged files").option("--command <command>", "Command or action that failed").option("--intent <intent>", "Proposed user intent or action to check before mutating").option("--result <result>", "Command result preview").option("--exit-code <code>", "Command exit code").option("--status <status>", "Command status").option("--destructive", "Treat the proposed action as destructive or irreversible").option("--require-confirmation", "Require explicit user confirmation before continuing").option(
|
|
32052
32104
|
"--confirmed-by-user <confirmation>",
|
|
32053
32105
|
"Explicit user confirmation text that permits a strict destructive/contradictory override"
|
|
32054
|
-
).option("--strict", "Exit non-zero if guidance is required but unavailable").option("--category <categories...>", "Additional memory categories to recall").option("--no-context", "Skip source context query").option("--no-recent-failures", "Skip recent Companion event failure inspection").option("--json", "Print raw JSON").action(async (options) => {
|
|
32106
|
+
).option("--strict", "Exit non-zero if guidance is required but unavailable").option("--category <categories...>", "Additional memory categories to recall").option("--no-context", "Skip source context query").option("--no-recent-failures", "Skip recent Companion event failure inspection").option("--json", "Print raw JSON").option("--verbose", "Print full non-blocking guard details instead of one-line success").action(async (options) => {
|
|
32055
32107
|
await memoryGuardCheckCommand({
|
|
32056
32108
|
trigger: options.trigger,
|
|
32057
32109
|
files: [
|
|
@@ -32071,7 +32123,8 @@ program.command("memory-guard").description(
|
|
|
32071
32123
|
categories: options.category,
|
|
32072
32124
|
includeContext: options.context,
|
|
32073
32125
|
recentFailures: options.recentFailures,
|
|
32074
|
-
json: options.json
|
|
32126
|
+
json: options.json,
|
|
32127
|
+
verbose: options.verbose
|
|
32075
32128
|
});
|
|
32076
32129
|
})
|
|
32077
32130
|
).addCommand(
|
|
@@ -32979,7 +33032,7 @@ collaboration.command("guard").description("Check files or resources against act
|
|
|
32979
33032
|
).option("-a, --action <action>", "Guarded action label", "edit").option("--actor <actor>", "Developer or agent display name").option("--actor-id <actorId>", "Stable developer or agent id").option("--actor-type <actorType>", "HUMAN|AGENT|SYSTEM", "AGENT").option("--session-id <sessionId>", "Automation/session id").option("--work-session-id <workSessionId>", "Existing hosted work session id").option("--client <client>", "Client label", "snipara-companion").option("--repository <repository>", "Repository id").option("-b, --branch <branch>", "Current branch name").option("--worktree <worktree>", "Worktree path").option("--max-files <number>", "Maximum files for local code resource expansion", "2000").option("--no-persist", "Evaluate without storing a guard event").option("--enforce", "Exit non-zero for REVIEW_REQUIRED or REQUIRES_ACK, not only BLOCKED").option(
|
|
32980
33033
|
"--ack-review-only",
|
|
32981
33034
|
"Under --enforce, acknowledge review-only stale-state and decision-consistency warnings"
|
|
32982
|
-
).option("-d, --dir <directory>", "Repository directory (default: current)").option("--json", "Print raw JSON").action(async (options) => {
|
|
33035
|
+
).option("-d, --dir <directory>", "Repository directory (default: current)").option("--json", "Print raw JSON").option("--verbose", "Print the full guard report even when the guard passes").action(async (options) => {
|
|
32983
33036
|
await collaborationGuardCommand({
|
|
32984
33037
|
files: options.files,
|
|
32985
33038
|
resources: options.resource,
|
|
@@ -32999,7 +33052,8 @@ collaboration.command("guard").description("Check files or resources against act
|
|
|
32999
33052
|
enforce: Boolean(options.enforce),
|
|
33000
33053
|
ackReviewOnly: Boolean(options.ackReviewOnly),
|
|
33001
33054
|
dir: options.dir,
|
|
33002
|
-
json: options.json
|
|
33055
|
+
json: options.json,
|
|
33056
|
+
verbose: Boolean(options.verbose || process.argv.includes("--verbose"))
|
|
33003
33057
|
});
|
|
33004
33058
|
});
|
|
33005
33059
|
collaboration.command("hooks").description("Install blocking Git hooks that run the hosted collaboration guard").addCommand(
|
|
@@ -33757,6 +33811,7 @@ if (require.main === module) {
|
|
|
33757
33811
|
realityCheckCommand,
|
|
33758
33812
|
referencesIngestCommand,
|
|
33759
33813
|
referencesScanCommand,
|
|
33814
|
+
resolveAutoWorkflowMode,
|
|
33760
33815
|
resolveContextPackRecord,
|
|
33761
33816
|
resolveFullWorkflowTokenBudget,
|
|
33762
33817
|
resolveLocalWorkerRoutingDefaults,
|
package/docs/FULL_REFERENCE.md
CHANGED
|
@@ -137,11 +137,11 @@ For Codex, the primary integration remains Hosted MCP plus `AGENTS.md`.
|
|
|
137
137
|
- `snipara-companion` is still skippable with `--profile hosted-only` or `--skip-companion`.
|
|
138
138
|
- Use it when compaction-safe phase commits, Project Intelligence briefs, local doctor checks, or shared helper workflows are useful.
|
|
139
139
|
- Use `workflow scaffold --preset project-intelligence-continuity-layer` for roadmap-sized Project Intelligence work that needs phase commits.
|
|
140
|
-
-
|
|
140
|
+
- Normal agent sessions intentionally expose a small Snipara tool set. Use `snipara_help(query=...)` for routed guidance and `snipara_help(list_all=true)` to inspect specialist tools before requesting an expanded surface.
|
|
141
141
|
|
|
142
142
|
## Configuring MCP Tool Surfaces
|
|
143
143
|
|
|
144
|
-
The MCP server advertises different tool surfaces depending on the `SNIPARA_EXPOSED_SURFACES` environment variable. Hosted MCP defaults to
|
|
144
|
+
The MCP server advertises different tool surfaces depending on the `SNIPARA_EXPOSED_SURFACES` environment variable. Hosted MCP defaults to the lean agent contract: context, search, read, stats, help, memory recall/capture, and end-of-task commit. Specialist inline, companion, and orchestrator tools stay discoverable via `snipara_help`, which now marks them as `routed_or_opt_in`; standard agents should usually stay on the simple verbs and let Snipara route internally. To expose companion tools directly in the advertised manifest, set `SNIPARA_EXPOSED_SURFACES=inline,companion` on the MCP server. To expose swarm and htask coordination tools, use `SNIPARA_EXPOSED_SURFACES=inline,orchestrator`. Standard MCP agents only receive schemas for tools returned by `tools/list`.
|
|
145
145
|
|
|
146
146
|
## Installation
|
|
147
147
|
|