mancode 0.4.0 → 0.4.1
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/README.en.md +13 -4
- package/README.md +11 -4
- package/dist/{chunk-K3MYY47M.js → chunk-VV3MFVIG.js} +3 -2
- package/dist/chunk-VV3MFVIG.js.map +1 -0
- package/dist/cli.js +126 -15
- package/dist/cli.js.map +1 -1
- package/dist/{v3-adapter-URAKH6BV.js → v3-adapter-OS2AEK5M.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-K3MYY47M.js.map +0 -1
- /package/dist/{v3-adapter-URAKH6BV.js.map → v3-adapter-OS2AEK5M.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -134,7 +134,7 @@ import {
|
|
|
134
134
|
stageV3AdapterUpgradeFiles,
|
|
135
135
|
v3AdapterTargetPath,
|
|
136
136
|
v3AdapterVersionsFromStatuses
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-VV3MFVIG.js";
|
|
138
138
|
|
|
139
139
|
// src/cli.ts
|
|
140
140
|
import { Option, program } from "commander";
|
|
@@ -5185,8 +5185,31 @@ async function commitTaskOperation(context, previous) {
|
|
|
5185
5185
|
{ canAbort: false }
|
|
5186
5186
|
);
|
|
5187
5187
|
throwIfOperationCrashInjected(previous.type, "commit");
|
|
5188
|
+
await refreshActiveSessionRevision(context);
|
|
5188
5189
|
return next;
|
|
5189
5190
|
}
|
|
5191
|
+
async function refreshActiveSessionRevision(context) {
|
|
5192
|
+
try {
|
|
5193
|
+
const session = await readSession(
|
|
5194
|
+
context.projectRoot,
|
|
5195
|
+
context.session.sessionId
|
|
5196
|
+
);
|
|
5197
|
+
if (session === null || session.status !== "active" || session.activeTaskRef === null || !sameTaskRef(session.activeTaskRef, context.taskRef)) {
|
|
5198
|
+
return;
|
|
5199
|
+
}
|
|
5200
|
+
const task = await context.store.readTaskSnapshot(context.taskRef);
|
|
5201
|
+
if (task.metadata.status !== "in_progress" && task.metadata.status !== "blocked") {
|
|
5202
|
+
return;
|
|
5203
|
+
}
|
|
5204
|
+
await resumeSession(context.projectRoot, session.sessionId, {
|
|
5205
|
+
taskRef: context.taskRef,
|
|
5206
|
+
workflowMode: task.metadata.workflowMode,
|
|
5207
|
+
taskRevision: task.metadata.revision,
|
|
5208
|
+
now: context.now
|
|
5209
|
+
});
|
|
5210
|
+
} catch {
|
|
5211
|
+
}
|
|
5212
|
+
}
|
|
5190
5213
|
async function handleTaskOperationFailure(context, journal) {
|
|
5191
5214
|
if (journal.state === "committed" || journal.state === "aborted") return;
|
|
5192
5215
|
if (hasBusinessWriteIntent(journal)) {
|
|
@@ -6835,8 +6858,8 @@ import { getEncoding } from "js-tiktoken";
|
|
|
6835
6858
|
var CONTEXT_PACK_TOKENIZER_ID = "cl100k_base@tiktoken-0.7.0";
|
|
6836
6859
|
var CONTEXT_PACK_BUDGET_ALGORITHM_VERSION = "complete-section-v1";
|
|
6837
6860
|
var CONTEXT_PACK_DEFAULT_BUDGETS = {
|
|
6838
|
-
bootstrap:
|
|
6839
|
-
task:
|
|
6861
|
+
bootstrap: 1600,
|
|
6862
|
+
task: 5e3
|
|
6840
6863
|
};
|
|
6841
6864
|
var fixedTokenizer = getEncoding("cl100k_base");
|
|
6842
6865
|
var FIXED_CONTEXT_PACK_TOKEN_COUNTER = {
|
|
@@ -9860,7 +9883,7 @@ async function activateLegacyMigration(input) {
|
|
|
9860
9883
|
for (const action of payload.actions.filter(
|
|
9861
9884
|
(action2) => action2.kind === "v3_adapter_file"
|
|
9862
9885
|
)) {
|
|
9863
|
-
const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-
|
|
9886
|
+
const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-OS2AEK5M.js");
|
|
9864
9887
|
await applyV3AdapterFilePlan2(root, action);
|
|
9865
9888
|
}
|
|
9866
9889
|
journal = await completeActivationStep(
|
|
@@ -13716,7 +13739,7 @@ async function upgradeV3Adapters(input) {
|
|
|
13716
13739
|
if (unfinished.length > 0) {
|
|
13717
13740
|
throw new Error("MANCODE_ADAPTER_UPGRADE_OPERATION_PENDING");
|
|
13718
13741
|
}
|
|
13719
|
-
const actualVersions = await import("./v3-adapter-
|
|
13742
|
+
const actualVersions = await import("./v3-adapter-OS2AEK5M.js").then(
|
|
13720
13743
|
({ inspectV3AdapterVersions: inspectV3AdapterVersions2 }) => inspectV3AdapterVersions2(
|
|
13721
13744
|
root,
|
|
13722
13745
|
managedAdapterNames(project.manifest.managedAdapters)
|
|
@@ -19332,7 +19355,7 @@ function buildStablePack(snapshot, session, request, writeBlockers, now) {
|
|
|
19332
19355
|
[task.fingerprint, coordination.fingerprint, project.fingerprint],
|
|
19333
19356
|
true
|
|
19334
19357
|
),
|
|
19335
|
-
runtimeSection("/capabilities", capabilities, true),
|
|
19358
|
+
runtimeSection("/capabilities", capabilitiesProjection(capabilities), true),
|
|
19336
19359
|
runtimeSection(
|
|
19337
19360
|
"/transportFreshness",
|
|
19338
19361
|
transportFreshnessProjection(capabilities),
|
|
@@ -19427,7 +19450,11 @@ function buildRepairPack(snapshot, session, request, repair, now) {
|
|
|
19427
19450
|
true
|
|
19428
19451
|
),
|
|
19429
19452
|
derivedSection("/conflicts", repair.issues, [snapshot.fingerprint], true),
|
|
19430
|
-
runtimeSection(
|
|
19453
|
+
runtimeSection(
|
|
19454
|
+
"/capabilities",
|
|
19455
|
+
capabilitiesProjection(capabilities),
|
|
19456
|
+
true
|
|
19457
|
+
),
|
|
19431
19458
|
runtimeSection(
|
|
19432
19459
|
"/transportFreshness",
|
|
19433
19460
|
transportFreshnessProjection(capabilities),
|
|
@@ -19467,6 +19494,7 @@ function sessionProjection(session) {
|
|
|
19467
19494
|
};
|
|
19468
19495
|
}
|
|
19469
19496
|
function activeTaskProjection(task) {
|
|
19497
|
+
const governance = task.metadata.governance;
|
|
19470
19498
|
return {
|
|
19471
19499
|
taskRef: task.metadata.taskRef,
|
|
19472
19500
|
workflowMode: task.metadata.workflowMode,
|
|
@@ -19477,7 +19505,14 @@ function activeTaskProjection(task) {
|
|
|
19477
19505
|
currentStep: task.metadata.currentStep,
|
|
19478
19506
|
ownerActorId: task.metadata.ownerActorId,
|
|
19479
19507
|
implementationScope: task.metadata.implementationScope,
|
|
19480
|
-
governance:
|
|
19508
|
+
governance: {
|
|
19509
|
+
requirementsStatus: governance.requirementsStatus,
|
|
19510
|
+
planVersion: governance.planVersion,
|
|
19511
|
+
planDecision: governance.planDecision,
|
|
19512
|
+
policyVersions: governance.policyVersions,
|
|
19513
|
+
reviewStatus: governance.reviewStatus,
|
|
19514
|
+
verificationStatus: governance.verificationStatus
|
|
19515
|
+
},
|
|
19481
19516
|
plan: task.plan?.artifactRef ?? null,
|
|
19482
19517
|
latestCheckpointRef: task.metadata.latestCheckpointRef
|
|
19483
19518
|
};
|
|
@@ -19531,7 +19566,6 @@ function projectProjection(project) {
|
|
|
19531
19566
|
teamPolicy: project.policy.policy,
|
|
19532
19567
|
defaultVisibility: project.policy.defaultVisibility,
|
|
19533
19568
|
schemaEpoch: project.manifest.epoch,
|
|
19534
|
-
activationState: project.manifest.activationState,
|
|
19535
19569
|
facts: project.projectFacts,
|
|
19536
19570
|
confirmedDecisions: project.confirmedDecisions
|
|
19537
19571
|
};
|
|
@@ -19597,6 +19631,13 @@ function transportFreshnessProjection(capabilities) {
|
|
|
19597
19631
|
remoteRevision: capabilities.remoteRevision
|
|
19598
19632
|
};
|
|
19599
19633
|
}
|
|
19634
|
+
function capabilitiesProjection(capabilities) {
|
|
19635
|
+
return {
|
|
19636
|
+
claimAcquisition: capabilities.claimAcquisition,
|
|
19637
|
+
writeGuard: capabilities.writeGuard,
|
|
19638
|
+
transport: capabilities.transport
|
|
19639
|
+
};
|
|
19640
|
+
}
|
|
19600
19641
|
function parentFreshnessSection(snapshot) {
|
|
19601
19642
|
if (snapshot.task.metadata.parent === null) return null;
|
|
19602
19643
|
const value = snapshot.parentReadError !== null ? { state: "unavailable", reasons: ["parent_unavailable"] } : {
|
|
@@ -34907,7 +34948,7 @@ async function assertCleanGitWorktree(projectRoot, materializedTaskRef) {
|
|
|
34907
34948
|
cwd: projectRoot,
|
|
34908
34949
|
windowsHide: true
|
|
34909
34950
|
});
|
|
34910
|
-
if (stdout2.trim()) throw new Error("
|
|
34951
|
+
if (stdout2.trim()) throw new Error("MANCODE_GIT_REF_DIRTY_WORKTREE");
|
|
34911
34952
|
}
|
|
34912
34953
|
async function hasCommittedHandoffCheckpoint(context) {
|
|
34913
34954
|
const checkpoint = context.task.latestCheckpoint;
|
|
@@ -44531,6 +44572,7 @@ async function publishTaskMutation(input) {
|
|
|
44531
44572
|
if (recovery.state !== "committed" || recovery.materialization === null) {
|
|
44532
44573
|
throw new Error("MANCODE_REMOTE_RECEIPT_MISMATCH");
|
|
44533
44574
|
}
|
|
44575
|
+
await refreshGitRefSessionProjection(input);
|
|
44534
44576
|
return {
|
|
44535
44577
|
remoteRevision: mutation.remoteRevision,
|
|
44536
44578
|
ownershipEpoch: mutation.ownershipEpoch,
|
|
@@ -44557,6 +44599,38 @@ async function publishTaskMutation(input) {
|
|
|
44557
44599
|
throw error;
|
|
44558
44600
|
}
|
|
44559
44601
|
}
|
|
44602
|
+
async function refreshGitRefSessionProjection(input) {
|
|
44603
|
+
try {
|
|
44604
|
+
const session = await readSession(
|
|
44605
|
+
input.context.projectRoot,
|
|
44606
|
+
input.context.session.sessionId
|
|
44607
|
+
);
|
|
44608
|
+
if (session === null || session.status !== "active" || session.activeTaskRef === null || !sameTaskRef(session.activeTaskRef, input.context.taskRef)) {
|
|
44609
|
+
return;
|
|
44610
|
+
}
|
|
44611
|
+
const task = await input.context.store.readTaskSnapshot(
|
|
44612
|
+
input.context.taskRef
|
|
44613
|
+
);
|
|
44614
|
+
if (task.metadata.status === "in_progress" || task.metadata.status === "blocked") {
|
|
44615
|
+
await resumeSession(input.context.projectRoot, session.sessionId, {
|
|
44616
|
+
taskRef: input.context.taskRef,
|
|
44617
|
+
workflowMode: task.metadata.workflowMode,
|
|
44618
|
+
taskRevision: task.metadata.revision,
|
|
44619
|
+
now: input.now
|
|
44620
|
+
});
|
|
44621
|
+
return;
|
|
44622
|
+
}
|
|
44623
|
+
await clearSessionTaskPointer(
|
|
44624
|
+
input.context.projectRoot,
|
|
44625
|
+
session.sessionId,
|
|
44626
|
+
{
|
|
44627
|
+
expectedTaskRef: input.context.taskRef,
|
|
44628
|
+
now: input.now
|
|
44629
|
+
}
|
|
44630
|
+
);
|
|
44631
|
+
} catch {
|
|
44632
|
+
}
|
|
44633
|
+
}
|
|
44560
44634
|
function assertScopeChangeEligible2(context, fence, scope) {
|
|
44561
44635
|
const metadata = context.task.metadata;
|
|
44562
44636
|
if (metadata.workflowMode !== "manteam" || metadata.status !== "in_progress" || metadata.ownerActorId !== context.session.actorId || fence.ownerActorId !== context.session.actorId) {
|
|
@@ -45718,10 +45792,16 @@ async function workflowVerifyV3(rootDir, args, options) {
|
|
|
45718
45792
|
}
|
|
45719
45793
|
try {
|
|
45720
45794
|
const project = await readV3CommandProject(rootDir);
|
|
45795
|
+
const taskRef = parseTaskRef(task);
|
|
45796
|
+
assertDeferredGitRefSyncOption(
|
|
45797
|
+
project.project.config.transport.mode,
|
|
45798
|
+
taskRef.namespace === "shared",
|
|
45799
|
+
options.sync
|
|
45800
|
+
);
|
|
45721
45801
|
const session = await resolveV3CommandSession(project, options);
|
|
45722
45802
|
const result2 = await recordV3Verification({
|
|
45723
45803
|
projectRoot: project.projectRoot,
|
|
45724
|
-
taskRef
|
|
45804
|
+
taskRef,
|
|
45725
45805
|
sessionId: session.sessionId,
|
|
45726
45806
|
expectedTaskRevision,
|
|
45727
45807
|
verification: await readWorkflowJsonInputFile(
|
|
@@ -45768,10 +45848,16 @@ async function workflowReviewV3(rootDir, args, options) {
|
|
|
45768
45848
|
}
|
|
45769
45849
|
try {
|
|
45770
45850
|
const project = await readV3CommandProject(rootDir);
|
|
45851
|
+
const taskRef = parseTaskRef(task);
|
|
45852
|
+
assertDeferredGitRefSyncOption(
|
|
45853
|
+
project.project.config.transport.mode,
|
|
45854
|
+
taskRef.namespace === "shared",
|
|
45855
|
+
options.sync
|
|
45856
|
+
);
|
|
45771
45857
|
const session = await resolveV3CommandSession(project, options);
|
|
45772
45858
|
const result2 = await applyV3ReviewLedger({
|
|
45773
45859
|
projectRoot: project.projectRoot,
|
|
45774
|
-
taskRef
|
|
45860
|
+
taskRef,
|
|
45775
45861
|
sessionId: session.sessionId,
|
|
45776
45862
|
expectedTaskRevision,
|
|
45777
45863
|
review: await readWorkflowJsonInputFile(
|
|
@@ -45835,8 +45921,13 @@ async function workflowPlanV3(rootDir, args, options) {
|
|
|
45835
45921
|
}
|
|
45836
45922
|
try {
|
|
45837
45923
|
const project = await readV3CommandProject(rootDir);
|
|
45838
|
-
const session = await resolveV3CommandSession(project, options);
|
|
45839
45924
|
const taskRef = parseTaskRef(task);
|
|
45925
|
+
assertDeferredGitRefSyncOption(
|
|
45926
|
+
project.project.config.transport.mode,
|
|
45927
|
+
taskRef.namespace === "shared",
|
|
45928
|
+
options.sync
|
|
45929
|
+
);
|
|
45930
|
+
const session = await resolveV3CommandSession(project, options);
|
|
45840
45931
|
const plan = action === "revise" ? await readWorkflowInputFile(
|
|
45841
45932
|
project.projectRoot,
|
|
45842
45933
|
options.file
|
|
@@ -45893,8 +45984,13 @@ async function workflowRequirementsV3(rootDir, args, options) {
|
|
|
45893
45984
|
}
|
|
45894
45985
|
try {
|
|
45895
45986
|
const project = await readV3CommandProject(rootDir);
|
|
45896
|
-
const session = await resolveV3CommandSession(project, options);
|
|
45897
45987
|
const taskRef = parseTaskRef(task);
|
|
45988
|
+
assertDeferredGitRefSyncOption(
|
|
45989
|
+
project.project.config.transport.mode,
|
|
45990
|
+
taskRef.namespace === "shared",
|
|
45991
|
+
options.sync
|
|
45992
|
+
);
|
|
45993
|
+
const session = await resolveV3CommandSession(project, options);
|
|
45898
45994
|
const requirementsInput = await readWorkflowJsonInputFile(
|
|
45899
45995
|
project.projectRoot,
|
|
45900
45996
|
options.file
|
|
@@ -45935,6 +46031,15 @@ async function workflowRequirementsV3(rootDir, args, options) {
|
|
|
45935
46031
|
function parseExpectedTaskRevision(options) {
|
|
45936
46032
|
return options.expectedRevision === void 0 ? null : parseExactPositiveInteger(options.expectedRevision);
|
|
45937
46033
|
}
|
|
46034
|
+
function assertDeferredGitRefSyncOption(transportMode, sharedTask, sync) {
|
|
46035
|
+
if (sync !== true) return;
|
|
46036
|
+
if (transportMode === "git-ref" && sharedTask) {
|
|
46037
|
+
throw new Error(
|
|
46038
|
+
"MANCODE_GIT_REF_DEFERRED_SYNC_REQUIRED: run this mutation without --sync, commit the resulting .mancode/shared authority changes with the matching code head, then run mancode team sync push <shared:ULID> --expected-task-revision <n>."
|
|
46039
|
+
);
|
|
46040
|
+
}
|
|
46041
|
+
throw new Error("MANCODE_GIT_REF_SYNC_UNAVAILABLE");
|
|
46042
|
+
}
|
|
45938
46043
|
function parseV3PlanDecision(value) {
|
|
45939
46044
|
if (value === void 0) return void 0;
|
|
45940
46045
|
if (value === "plan_only" || value === "governed_execution") return value;
|
|
@@ -45981,6 +46086,12 @@ async function workflowCreateV3(rootDir, args, options) {
|
|
|
45981
46086
|
}
|
|
45982
46087
|
try {
|
|
45983
46088
|
const project = await readV3CommandProject(rootDir);
|
|
46089
|
+
const parsedWorkflowMode = parseV3WorkflowMode(workflowMode);
|
|
46090
|
+
assertDeferredGitRefSyncOption(
|
|
46091
|
+
project.project.config.transport.mode,
|
|
46092
|
+
parsedWorkflowMode === "manteam",
|
|
46093
|
+
options.sync
|
|
46094
|
+
);
|
|
45984
46095
|
const session = await resolveV3CommandSession(project, options);
|
|
45985
46096
|
const parentOption = options.parent ?? options.parentTask;
|
|
45986
46097
|
if (options.parentTask !== void 0 && options.parent === void 0) {
|
|
@@ -45999,7 +46110,7 @@ async function workflowCreateV3(rootDir, args, options) {
|
|
|
45999
46110
|
const result2 = await createV3Workflow({
|
|
46000
46111
|
projectRoot: project.projectRoot,
|
|
46001
46112
|
task,
|
|
46002
|
-
workflowMode:
|
|
46113
|
+
workflowMode: parsedWorkflowMode,
|
|
46003
46114
|
sessionId: session.sessionId,
|
|
46004
46115
|
client: commandClient(options.client),
|
|
46005
46116
|
parentTaskRef: parentOption === void 0 ? null : parseTaskRef(parentOption),
|