cli-aimlock 7.0.37 → 7.0.38
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/aimlock-chain-executor.mjs +4 -5
- package/aimlock-coordination.mjs +4 -3
- package/aimlock-runtime.mjs +1 -1
- package/aimlock-tasks-cli.mjs +202 -0
- package/cli.mjs +4 -1
- package/package.json +7 -4
- package/skill/SKILL.md +12 -2
- package/skill/references/task-routing.md +13 -0
- package/skill/skill.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { decisionResumesTask, decisionTargetsTask } from 'cli-swarm/coordinator'
|
|
1
2
|
import { randomUUID } from 'node:crypto'
|
|
2
3
|
import { assertChainNotSuspended } from './aimlock-coordination.mjs'
|
|
3
4
|
import { fail } from './aimlock-local-fs.mjs'
|
|
@@ -57,14 +58,13 @@ function finish(record, output, status) {
|
|
|
57
58
|
|
|
58
59
|
async function stillWaiting(session, output, pending) {
|
|
59
60
|
if (output.status === 'waiting') return true
|
|
60
|
-
const releasedByHuman = pending.decision
|
|
61
|
-
&& pending.decision.answer === 'resume:' + pending.input.agentId
|
|
61
|
+
const releasedByHuman = pending.decision && decisionResumesTask(pending.decision, pending.input)
|
|
62
62
|
if (output.status !== 'blocked' || (output.wakePackage?.reason !== 'event-received' && !releasedByHuman)) return false
|
|
63
63
|
const current = (await callCoordinator(session, 'status', {})).state
|
|
64
64
|
const task = current.tasks.find((item) => item.taskId === pending.input.taskId)
|
|
65
65
|
if (!task || ['completed', 'failed', 'reclaimed'].includes(task.status)) return false
|
|
66
66
|
return current.waits.some((wait) => wait.taskId === task.taskId && wait.status === 'active')
|
|
67
|
-
|| current.decisions.some((decision) => decision.status === 'pending'
|
|
67
|
+
|| current.decisions.some((decision) => decisionTargetsTask(decision, task) && decision.status === 'pending')
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
async function driveWait(session) {
|
|
@@ -80,8 +80,7 @@ async function driveWait(session) {
|
|
|
80
80
|
await prepareHuman(session, output.confirmProtocolRequests[0].input.interaction, pending.input)
|
|
81
81
|
return
|
|
82
82
|
}
|
|
83
|
-
const releasedByHuman = pending.decision
|
|
84
|
-
&& pending.decision.answer === 'resume:' + pending.input.agentId
|
|
83
|
+
const releasedByHuman = pending.decision && decisionResumesTask(pending.decision, pending.input)
|
|
85
84
|
&& output.status === 'resolved'
|
|
86
85
|
if (releasedByHuman) {
|
|
87
86
|
finish(session.record, { ...output, status: 'resolved-by-human',
|
package/aimlock-coordination.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { decisionResumesTask, decisionTargetsTask } from 'cli-swarm/coordinator'
|
|
1
2
|
import { verify } from 'node:crypto'
|
|
2
3
|
import { lstat, readFile } from 'node:fs/promises'
|
|
3
4
|
import { basename, resolve } from 'node:path'
|
|
@@ -35,9 +36,9 @@ function failureHandled(task, tasks, inspected = new Set()) {
|
|
|
35
36
|
|
|
36
37
|
function parkedAfterDecision(task, tasks, decisions) {
|
|
37
38
|
if (task.status !== 'blocked' || task.blockedReason !== 'human-decision') return false
|
|
38
|
-
const decision = decisions.findLast((item) => item
|
|
39
|
+
const decision = decisions.findLast((item) => decisionTargetsTask(item, task))
|
|
39
40
|
return decision?.status === 'resolved'
|
|
40
|
-
&& tasks.some((active) => active.status === 'active' && decision
|
|
41
|
+
&& tasks.some((active) => active.status === 'active' && decisionResumesTask(decision, active))
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
function assertChainRunnable(state, chainId) {
|
|
@@ -46,7 +47,7 @@ function assertChainRunnable(state, chainId) {
|
|
|
46
47
|
const wait = state.waits.find((item) => item.chainId === chainId && item.status === 'active')
|
|
47
48
|
if (wait) fail('AIMLOCK_COORDINATION_WAITING', 'chain ' + chainId + ' is suspended until ' + wait.event + ' or ' + wait.deadlineAt)
|
|
48
49
|
const pending = state.decisions.some((decision) => decision.status === 'pending'
|
|
49
|
-
&& tasks.some((task) => decision
|
|
50
|
+
&& tasks.some((task) => decisionTargetsTask(decision, task)))
|
|
50
51
|
const unresolved = tasks.some((task) => ['failed', 'reclaimed'].includes(task.status)
|
|
51
52
|
&& !failureHandled(task, tasks))
|
|
52
53
|
if (!tasks.some((task) => task.status === 'active') || pending || unresolved
|
package/aimlock-runtime.mjs
CHANGED
|
@@ -209,7 +209,7 @@ const RESPONSE_SCHEMA = "aimlock.skill.response/1.1";
|
|
|
209
209
|
const ERROR_SCHEMA = "aimlock.skill.error/1.0";
|
|
210
210
|
const CONTRACT_SCHEMA = "aimlock.scope-contract/1.0";
|
|
211
211
|
const COMPILER_NAME = "aimlock";
|
|
212
|
-
const COMPILER_VERSION = "v7.0.
|
|
212
|
+
const COMPILER_VERSION = "v7.0.38";
|
|
213
213
|
const KEEP_ALIVE_SECONDS = 90;
|
|
214
214
|
const KEEP_ALIVE_MESSAGE = "智能目标持续执行中,请勿关闭!";
|
|
215
215
|
const BYPASS_LINE_BUDGET = 500;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { stdin, stdout } from 'node:process'
|
|
2
|
+
import { executeCoordinatorOperation } from 'cli-swarm/coordinator'
|
|
3
|
+
import { errorRecord } from './aimlock-chain-model.mjs'
|
|
4
|
+
import { fail } from './aimlock-local-fs.mjs'
|
|
5
|
+
|
|
6
|
+
const TASK_INPUT_MAX_BYTES = 1_048_576
|
|
7
|
+
const MAX_TASK_DELIVERY_TIMEOUT_MS = 2_147_483_647
|
|
8
|
+
export const TASK_DELIVERY_TIMEOUT_MS = 30_000
|
|
9
|
+
export const TASK_OPERATIONS = Object.freeze([
|
|
10
|
+
'task-describe', 'task-checkpoint', 'task-resume', 'message-route', 'message-status',
|
|
11
|
+
'message-accept', 'message-complete', 'message-delivery-start', 'message-delivery-report',
|
|
12
|
+
'message-resolve', 'handoff-release', 'handoff-resume',
|
|
13
|
+
])
|
|
14
|
+
export const TASKS_USAGE = [
|
|
15
|
+
' cli-aimlock tasks <operation> <repositoryRoot> < task-message.json',
|
|
16
|
+
' cli-aimlock tasks capabilities <repositoryRoot>',
|
|
17
|
+
` Operations: ${TASK_OPERATIONS.join(', ')}.`,
|
|
18
|
+
' Message routing preserves the original plan. A resume package does not execute work.',
|
|
19
|
+
].join('\n')
|
|
20
|
+
|
|
21
|
+
function taskCapabilities(capabilities) {
|
|
22
|
+
if (!capabilities || !Array.isArray(capabilities.operations)
|
|
23
|
+
|| !capabilities.operationSchemas || typeof capabilities.operationSchemas !== 'object') {
|
|
24
|
+
fail('AIMLOCK_TASKS_CAPABILITIES_INVALID', 'coordinator task capabilities are invalid')
|
|
25
|
+
}
|
|
26
|
+
for (const operation of TASK_OPERATIONS) {
|
|
27
|
+
if (!capabilities.operations.includes(operation) || !Object.hasOwn(capabilities.operationSchemas, operation)) {
|
|
28
|
+
fail('AIMLOCK_TASKS_OPERATION_UNAVAILABLE', `coordinator task operation is unavailable: ${operation}`)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { operations: [...TASK_OPERATIONS], operationSchemas: Object.fromEntries(
|
|
32
|
+
TASK_OPERATIONS.map((operation) => [operation, capabilities.operationSchemas[operation]]),
|
|
33
|
+
) }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function readTaskInput(input) {
|
|
37
|
+
const chunks = []
|
|
38
|
+
let byteLength = 0
|
|
39
|
+
for await (const chunk of input) {
|
|
40
|
+
if (typeof chunk !== 'string' && !(chunk instanceof Uint8Array)) {
|
|
41
|
+
fail('AIMLOCK_TASKS_INPUT_INVALID', 'task input must be UTF-8 JSON')
|
|
42
|
+
}
|
|
43
|
+
const bytes = Buffer.from(chunk)
|
|
44
|
+
byteLength += bytes.byteLength
|
|
45
|
+
if (byteLength > TASK_INPUT_MAX_BYTES) fail('AIMLOCK_TASKS_INPUT_TOO_LARGE', 'task input exceeds 1 MiB')
|
|
46
|
+
chunks.push(bytes)
|
|
47
|
+
}
|
|
48
|
+
if (byteLength === 0) fail('AIMLOCK_TASKS_INPUT_REQUIRED', 'task input is required on stdin')
|
|
49
|
+
let value
|
|
50
|
+
try { value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(Buffer.concat(chunks))) }
|
|
51
|
+
catch { fail('AIMLOCK_TASKS_INPUT_INVALID', 'task input must be valid UTF-8 JSON') }
|
|
52
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
53
|
+
fail('AIMLOCK_TASKS_INPUT_INVALID', 'task input must be a JSON object')
|
|
54
|
+
}
|
|
55
|
+
return value
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function dispatchTasks(args, dependencies = {}) {
|
|
59
|
+
const [operation, repositoryRoot] = args
|
|
60
|
+
if (args.length !== 2 || (operation !== 'capabilities' && !TASK_OPERATIONS.includes(operation))) {
|
|
61
|
+
fail('AIMLOCK_TASKS_USAGE_INVALID', TASKS_USAGE)
|
|
62
|
+
}
|
|
63
|
+
const execute = dependencies.executeCoordinatorOperation ?? executeCoordinatorOperation
|
|
64
|
+
const input = dependencies.input ?? stdin
|
|
65
|
+
if (operation === 'capabilities') return taskCapabilities(await execute(operation, repositoryRoot, {}))
|
|
66
|
+
return execute(operation, repositoryRoot, await readTaskInput(input))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function runTasksCli(args) {
|
|
70
|
+
try {
|
|
71
|
+
const result = await dispatchTasks(args)
|
|
72
|
+
stdout.write(JSON.stringify(result) + '\n')
|
|
73
|
+
if (result.status === 'blocked' || result.status === 'waiting') process.exitCode = 2
|
|
74
|
+
else if (result.status === 'failed' || result.status === 'uncertain') process.exitCode = 1
|
|
75
|
+
} catch (error) {
|
|
76
|
+
stdout.write(JSON.stringify({ status: 'failed', error: errorRecord(error) }) + '\n')
|
|
77
|
+
process.exitCode = 1
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function sourceIdentity(input) {
|
|
82
|
+
const identity = {}
|
|
83
|
+
for (const field of ['taskId', 'agentId', 'chainId']) {
|
|
84
|
+
if (typeof input?.[field] !== 'string' || !input[field].trim()) {
|
|
85
|
+
fail('AIMLOCK_TASKS_IDENTITY_REQUIRED', `task identity requires ${field}`)
|
|
86
|
+
}
|
|
87
|
+
identity[field] = input[field]
|
|
88
|
+
}
|
|
89
|
+
return identity
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function receiptMatches(receipt, delivery) {
|
|
93
|
+
return receipt && typeof receipt === 'object'
|
|
94
|
+
&& receipt.requestId === delivery.requestId && receipt.targetTaskId === delivery.targetTaskId
|
|
95
|
+
&& typeof receipt.receiptId === 'string' && receipt.receiptId.length > 0
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function deliveryStatus(execute, root, source, delivery) {
|
|
99
|
+
const status = await execute('message-status', root, { ...source, requestId: delivery.requestId })
|
|
100
|
+
if (!status || !Object.hasOwn(status, 'receipt')) {
|
|
101
|
+
fail('AIMLOCK_TASKS_RECEIPT_INVALID', 'coordinator message status has no receipt field')
|
|
102
|
+
}
|
|
103
|
+
if (status.receipt !== null && !receiptMatches(status.receipt, delivery)) {
|
|
104
|
+
fail('AIMLOCK_TASKS_RECEIPT_INVALID', 'coordinator receipt does not match the target delivery')
|
|
105
|
+
}
|
|
106
|
+
return status.receipt
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function awaitHostDelivery(adapter, delivery, timeoutMs) {
|
|
110
|
+
let timer
|
|
111
|
+
const deadline = new Promise((_resolve, reject) => {
|
|
112
|
+
timer = setTimeout(() => reject(Object.assign(new Error(
|
|
113
|
+
`host delivery timed out after ${timeoutMs} ms; the actual delivery was not canceled`,
|
|
114
|
+
), { code: 'AIMLOCK_TASKS_DELIVERY_TIMEOUT' })), timeoutMs)
|
|
115
|
+
})
|
|
116
|
+
try {
|
|
117
|
+
return await Promise.race([Promise.resolve().then(() => adapter.deliver(delivery)), deadline])
|
|
118
|
+
} finally { clearTimeout(timer) }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async function deliverTaskMessage(root, source, delivery, adapter, execute, timeoutMs) {
|
|
122
|
+
const recorded = await deliveryStatus(execute, root, source, delivery)
|
|
123
|
+
if (recorded) return { requestId: delivery.requestId, status: 'accepted', receipt: recorded, recovered: true }
|
|
124
|
+
const claim = await execute('message-delivery-start', root, { ...source, requestId: delivery.requestId })
|
|
125
|
+
if (!claim || typeof claim.claimed !== 'boolean'
|
|
126
|
+
|| (claim.claimed && (typeof claim.attemptId !== 'string' || !claim.attemptId))) {
|
|
127
|
+
fail('AIMLOCK_TASKS_DELIVERY_CLAIM_INVALID', 'coordinator delivery claim is invalid')
|
|
128
|
+
}
|
|
129
|
+
if (!claim.claimed) {
|
|
130
|
+
const receipt = await deliveryStatus(execute, root, source, delivery)
|
|
131
|
+
if (receipt) return { requestId: delivery.requestId, status: 'accepted', receipt, recovered: true }
|
|
132
|
+
fail('AIMLOCK_TASKS_DELIVERY_UNCERTAIN', 'delivery was already attempted; query its receipt before any further action')
|
|
133
|
+
}
|
|
134
|
+
let delivered
|
|
135
|
+
let deliveryError
|
|
136
|
+
try { delivered = await awaitHostDelivery(adapter, { ...delivery, attemptId: claim.attemptId }, timeoutMs) }
|
|
137
|
+
catch (error) { deliveryError = errorRecord(error) }
|
|
138
|
+
const receipt = await deliveryStatus(execute, root, source, delivery)
|
|
139
|
+
if (!receipt) {
|
|
140
|
+
const detail = deliveryError ? `: ${deliveryError.message}` : ''
|
|
141
|
+
fail('AIMLOCK_TASKS_DELIVERY_UNCERTAIN', `target acceptance has not been recorded${detail}`)
|
|
142
|
+
}
|
|
143
|
+
if (!deliveryError && (!receiptMatches(delivered, delivery) || delivered.status !== 'accepted'
|
|
144
|
+
|| delivered.receiptId !== receipt.receiptId)) {
|
|
145
|
+
fail('AIMLOCK_TASKS_RECEIPT_INVALID', 'adapter receipt does not match the recorded target acceptance')
|
|
146
|
+
}
|
|
147
|
+
return { requestId: delivery.requestId, status: 'accepted', receipt, recovered: Boolean(deliveryError),
|
|
148
|
+
...(deliveryError ? { deliveryError } : {}) }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function reportDeliveryFailure(root, source, delivery, error, execute, failures) {
|
|
152
|
+
const failure = errorRecord(error)
|
|
153
|
+
failures.push({ requestId: delivery.requestId, stage: 'delivery', error: failure })
|
|
154
|
+
try {
|
|
155
|
+
await execute('message-delivery-report', root, { ...source, requestId: delivery.requestId,
|
|
156
|
+
errorCode: typeof failure.code === 'string' ? failure.code : 'AIMLOCK_TASKS_DELIVERY_FAILED',
|
|
157
|
+
errorMessage: failure.message })
|
|
158
|
+
} catch (reportError) {
|
|
159
|
+
failures.push({ requestId: delivery.requestId, stage: 'delivery-report', error: errorRecord(reportError) })
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** A host adapter delivers messages; only the coordinator may issue durable acceptance receipts. */
|
|
164
|
+
export async function handleTaskMessage(root, input, adapter, { deliveryTimeoutMs = TASK_DELIVERY_TIMEOUT_MS } = {}) {
|
|
165
|
+
if (!adapter || typeof adapter.deliver !== 'function' || typeof adapter.continueTask !== 'function') {
|
|
166
|
+
fail('AIMLOCK_TASKS_ADAPTER_REQUIRED', 'host adapter requires deliver and continueTask functions')
|
|
167
|
+
}
|
|
168
|
+
if (!Number.isSafeInteger(deliveryTimeoutMs) || deliveryTimeoutMs <= 0
|
|
169
|
+
|| deliveryTimeoutMs > MAX_TASK_DELIVERY_TIMEOUT_MS) {
|
|
170
|
+
fail('AIMLOCK_TASKS_TIMEOUT_INVALID', 'deliveryTimeoutMs must be a positive integer within the timer limit')
|
|
171
|
+
}
|
|
172
|
+
const source = sourceIdentity(input)
|
|
173
|
+
const execute = executeCoordinatorOperation
|
|
174
|
+
const routed = await execute('message-route', root, input)
|
|
175
|
+
if (!routed || !Array.isArray(routed.deliveries)
|
|
176
|
+
|| Object.keys(source).some((field) => routed.source?.[field] !== source[field])) {
|
|
177
|
+
fail('AIMLOCK_TASKS_ROUTE_INVALID', 'coordinator message route does not match the source task')
|
|
178
|
+
}
|
|
179
|
+
const deliveries = []
|
|
180
|
+
const failures = []
|
|
181
|
+
for (const delivery of routed.deliveries) {
|
|
182
|
+
if (delivery.status !== 'pending-delivery') continue
|
|
183
|
+
try { deliveries.push(await deliverTaskMessage(root, source, delivery, adapter, execute, deliveryTimeoutMs)) }
|
|
184
|
+
catch (error) { await reportDeliveryFailure(root, source, delivery, error, execute, failures) }
|
|
185
|
+
}
|
|
186
|
+
let continuation = null
|
|
187
|
+
let continuationDispatched = false
|
|
188
|
+
try {
|
|
189
|
+
continuation = await execute('task-resume', root, source)
|
|
190
|
+
if (!continuation || typeof continuation.canContinue !== 'boolean'
|
|
191
|
+
|| Object.keys(source).some((field) => continuation[field] !== source[field])) {
|
|
192
|
+
fail('AIMLOCK_TASKS_RESUME_INVALID', 'coordinator resume package does not match the original task')
|
|
193
|
+
}
|
|
194
|
+
if (continuation.canContinue) {
|
|
195
|
+
await adapter.continueTask(continuation)
|
|
196
|
+
continuationDispatched = true
|
|
197
|
+
}
|
|
198
|
+
} catch (error) { failures.push({ requestId: null, stage: 'continuation', error: errorRecord(error) }) }
|
|
199
|
+
return { status: failures.length ? 'failed' : continuationDispatched ? 'continued' : 'waiting',
|
|
200
|
+
messageId: routed.messageId, requests: routed.requests, deliveries, continuation,
|
|
201
|
+
continuationDispatched, failures }
|
|
202
|
+
}
|
package/cli.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { TASKS_USAGE, runTasksCli } from './aimlock-tasks-cli.mjs'
|
|
2
3
|
import { realpathSync } from 'node:fs'
|
|
3
4
|
import { dirname, resolve } from 'node:path'
|
|
4
5
|
import { cwd, stdin, stdout } from 'node:process'
|
|
@@ -95,7 +96,7 @@ export function localAimlockApplicability(facts) {
|
|
|
95
96
|
export function aimlockUsage(context) {
|
|
96
97
|
const usage = defaultUsage(context)
|
|
97
98
|
if (!usage.includes(COMMON_RUN_USAGE)) throw new Error('Shared CLI run usage contract changed')
|
|
98
|
-
return usage.replace(COMMON_RUN_USAGE, AIMLOCK_RUN_USAGE) + '\n\n' + CHAIN_USAGE
|
|
99
|
+
return usage.replace(COMMON_RUN_USAGE, AIMLOCK_RUN_USAGE) + '\n\n' + CHAIN_USAGE + '\n\n' + TASKS_USAGE
|
|
99
100
|
+ '\n\nRead-time renewal: local budget-auto-renew-request <repositoryRoot> prepares one Confirm Protocol approval;'
|
|
100
101
|
+ '\nlocal budget-auto-renew activates the approved chain/scope/policy; budget-auto-renew-stop revokes or completes it.'
|
|
101
102
|
}
|
|
@@ -196,6 +197,8 @@ const cliPath = fileURLToPath(import.meta.url)
|
|
|
196
197
|
if (process.argv[1] && realpathSync(resolve(process.argv[1])) === cliPath) {
|
|
197
198
|
if (process.argv[2] === 'brain') {
|
|
198
199
|
await runBrainCli(process.argv.slice(3))
|
|
200
|
+
} else if (process.argv[2] === 'tasks') {
|
|
201
|
+
await runTasksCli(process.argv.slice(3))
|
|
199
202
|
} else if (process.argv[2] === 'chain') {
|
|
200
203
|
await runChainCli(process.argv.slice(3))
|
|
201
204
|
} else if (process.argv[2] === 'local') {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"cli-aimlock": "./cli.mjs"
|
|
4
4
|
},
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"cli-swarm": "7.0.
|
|
6
|
+
"cli-swarm": "7.0.38"
|
|
7
7
|
},
|
|
8
8
|
"description": "Aimlock skill installer for CLI.Tax: lock a user request into an executable aim and route Blueprint, Swarm, and Calctool.",
|
|
9
9
|
"exports": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"./local-runner": "./aimlock-local-runner.mjs",
|
|
12
12
|
"./runtime": "./aimlock-runtime.mjs",
|
|
13
13
|
"./chain-executor": "./aimlock-chain-executor.mjs",
|
|
14
|
-
"./brain-client": "./brain-client.mjs"
|
|
14
|
+
"./brain-client": "./brain-client.mjs",
|
|
15
|
+
"./tasks": "./aimlock-tasks-cli.mjs"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"cli.mjs",
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
"aimlock-chain-human.mjs",
|
|
32
33
|
"aimlock-chain-executor.mjs",
|
|
33
34
|
"aimlock-chain-cli.mjs",
|
|
35
|
+
"aimlock-tasks-cli.mjs",
|
|
34
36
|
"aimlock-chain-outcomes.mjs",
|
|
35
37
|
"aimlock-context-map.mjs",
|
|
36
38
|
"aimlock-coordination.mjs",
|
|
@@ -44,7 +46,8 @@
|
|
|
44
46
|
"aimlock-runtime.mjs",
|
|
45
47
|
"brain-client.mjs",
|
|
46
48
|
"brain-client-files.mjs",
|
|
47
|
-
"skill/references/chain-executor.md"
|
|
49
|
+
"skill/references/chain-executor.md",
|
|
50
|
+
"skill/references/task-routing.md"
|
|
48
51
|
],
|
|
49
52
|
"license": "UNLICENSED",
|
|
50
53
|
"name": "cli-aimlock",
|
|
@@ -53,5 +56,5 @@
|
|
|
53
56
|
"url": "https://github.com/88208555/aimlock-clitax.git"
|
|
54
57
|
},
|
|
55
58
|
"type": "module",
|
|
56
|
-
"version": "7.0.
|
|
59
|
+
"version": "7.0.38"
|
|
57
60
|
}
|
package/skill/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: "Aimlock 仅用于大型、深度、跨模块、高风险、需要
|
|
|
5
5
|
|
|
6
6
|
# Aimlock Skill
|
|
7
7
|
|
|
8
|
-
Package version: v7.0.
|
|
8
|
+
Package version: v7.0.38
|
|
9
9
|
|
|
10
10
|
Endpoint: https://cli.tax/R3mQ8kWpXn
|
|
11
11
|
|
|
@@ -129,7 +129,7 @@ Call `interrupt` before acting on an interruption:
|
|
|
129
129
|
- forced stop → `stop`;
|
|
130
130
|
- status query → `status`;
|
|
131
131
|
- related addition → `fuse`;
|
|
132
|
-
- unrelated request → `spawn
|
|
132
|
+
- unrelated request → first query existing task ownership through `tasks message-route`; reuse its owner when resolved. Unresolved work remains a recorded pending request. Legacy `spawn` is a recommendation only and must not replace the current goal or create an unauthorized conversation.
|
|
133
133
|
|
|
134
134
|
For an active incomplete goal, the caller sends exactly every 90 seconds:
|
|
135
135
|
|
|
@@ -194,3 +194,13 @@ Aimlock returns the protocol; it does not start a timer.
|
|
|
194
194
|
仅在 TLS 握手前确定尚未发送 HTTP 请求时,broker 才允许最多 3 次连接尝试,并受总超时约束。请求发出后发生断线或响应中断,只用 GET 查询原 requestId 的服务端回执,禁止重发 POST;未取得有效回执时保留不确定状态,不得假定成功或继续依赖步骤。
|
|
195
195
|
|
|
196
196
|
`npx cli-aimlock@latest recover <operation> <requestId>` 可重新查询原调用,不会重做操作或重复计费。链恢复不会跳过人工确认,也不会自动重跑结果不确定的本地命令。代理连接需 Node.js 22.21+ 或 24.5+;不支持的运行时会明确报错。
|
|
197
|
+
|
|
198
|
+
## 新消息归属与原任务连续性
|
|
199
|
+
|
|
200
|
+
多任务协作时先登记任务目标、原始验收项和宿主定位;每条用户新需求在执行前使用 [task-routing.md](references/task-routing.md) 的 `task-describe → message-route → message-accept → task-resume` 协议。先查已有任务归属,再决定当前任务补充、转交、歧义暂存或显式接手。同一条消息的独立需求分别路由,不能用新消息覆盖原目标。
|
|
201
|
+
|
|
202
|
+
转交只是消息状态,不等于原任务完成。接收方按 requestId 去重,只有持久接收回执才算接手;来源任务继续不依赖该交接的工作。退出、上下文压缩或宿主重启后,必须先读取 `task-resume` 恢复原目标、检查点、未完成项与待投递请求。
|
|
203
|
+
|
|
204
|
+
用户明确要求在当前任务处理时,保留原目标;已由其他任务负责的范围需 `handoff-release` 完成安全交接,再重新验证 Aimlock 范围、快照与写入权限。禁止把别人的签名租约、预算或通过证据当作当前任务的新授权。归属不明只暂存新需求,不暂停原任务。
|
|
205
|
+
|
|
206
|
+
这些操作使用同一协调根目录的持久台账。宿主必须在新消息入口调用并消费结果;技能不能拦截未接入的 IDE,也不会自动创建会话、Git 分支、常驻服务或跨机器复制私密消息。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Aimlock task message entry
|
|
2
|
+
|
|
3
|
+
Use `cli-aimlock tasks capabilities <coordinationRoot>` to discover the task registration, routing, acknowledgement, handoff and resume schemas. JSON inputs use stdin. This entry calls the installed `cli-swarm/coordinator` directly and preserves its persistent ledger.
|
|
4
|
+
|
|
5
|
+
Before executing each new user requirement, restore the original task with `task-resume`, classify distinct items and call `message-route`. Reuse an existing owner when identified. Preserve uncertain requests and the current task's unfinished requirements. Do not append new user messages as replacement execution plans or overwrite chain state.
|
|
6
|
+
|
|
7
|
+
The installed Swarm reference `references/task-routing.md` defines the shared protocol, matching evidence, receipt validation and handoff lifecycle. Do not duplicate or maintain a separate routing algorithm in Aimlock.
|
|
8
|
+
|
|
9
|
+
The `cli-aimlock/tasks` export provides `handleTaskMessage(root,input,adapter,options)`. The IDE supplies an authorized destination-aware `deliver` function and `continueTask`. Each delivery must return the destination's persisted acceptance receipt. Atomic delivery claims prevent blind retries after process interruption. The helper checks authoritative message status and reports explicit failures; only a runnable source task continues. Delivery is bounded to 30 seconds unless the host sets a positive `options.deliveryTimeoutMs`. Timeouts preserve uncertain delivery without claiming it was cancelled; a runnable original task still continues.
|
|
10
|
+
|
|
11
|
+
Explicit forced assignment must preserve the current task checkpoint. Complete `handoff-release` at the previous owner's safe boundary, then obtain a fresh Aimlock contract/snapshot/pass for the receiving scope. After completion, the previous owner uses `handoff-resume` to refresh actual file fingerprints before rebuilding its own snapshot and continuing. Credentials, budgets and previous test receipts are never transferred as new authorization.
|
|
12
|
+
|
|
13
|
+
Status questions and explicit stop/cancel retain their existing host behavior. New requirements alone never cancel an unfinished goal. Each host must call this entry at its message boundary and consume pending inboxes after restart. The package cannot intercept unrelated hosts, create tasks or Git branches, install a background service, or grant access to unrelated accounts.
|
package/skill/skill.json
CHANGED