stella-timeline-plugin 2.0.1 → 2.0.3
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/src/runtime/openclaw_timeline_runtime.js +54 -54
- package/dist/src/tools/timeline_resolve.js +1 -1
- package/openclaw.plugin.json +54 -54
- package/package.json +72 -72
- package/scripts/doctor-openclaw-workspace.mjs +94 -94
- package/scripts/migrate-existing-memory.mjs +153 -153
- package/scripts/release.mjs +55 -55
- package/scripts/run-openclaw-live-e2e.mjs +64 -64
- package/scripts/setup-openclaw-workspace.mjs +119 -119
- package/skills/timeline/SKILL.md +111 -111
- package/templates/AGENTS.fragment.md +29 -29
- package/templates/SOUL.fragment.md +17 -17
|
@@ -317,35 +317,35 @@ function makePlannerRequestId() {
|
|
|
317
317
|
}
|
|
318
318
|
function buildTimelineQueryPlannerSystemPrompt() {
|
|
319
319
|
return [
|
|
320
|
-
'
|
|
321
|
-
'
|
|
322
|
-
'
|
|
323
|
-
'
|
|
324
|
-
'1.
|
|
325
|
-
'2.
|
|
326
|
-
'3. now
|
|
327
|
-
'4. past_point
|
|
328
|
-
'5. past_range
|
|
329
|
-
'6.
|
|
330
|
-
'7.
|
|
331
|
-
'8.
|
|
332
|
-
'9.
|
|
333
|
-
'10.
|
|
334
|
-
'11.
|
|
320
|
+
'You are the internal Timeline plugin query normalizer.',
|
|
321
|
+
'Your only task is to normalize a natural-language time request into a structured time plan that Timeline can execute.',
|
|
322
|
+
'Do not call tools. Do not output Markdown, explanations, or extra text. Output strict JSON only.',
|
|
323
|
+
'You must follow these constraints:',
|
|
324
|
+
'1. First classify the request as now, past_point, or past_range.',
|
|
325
|
+
'2. Do not classify mechanically from keywords. Interpret the actual time semantics in the user request.',
|
|
326
|
+
'3. For now, do not output normalized_point / normalized_start / normalized_end.',
|
|
327
|
+
'4. For past_point, normalized_point is required.',
|
|
328
|
+
'5. For past_range, normalized_start and normalized_end are required.',
|
|
329
|
+
'6. For colloquial ranges such as “最近”, normalize into concrete bounds using anchor.now.',
|
|
330
|
+
'7. For expressions such as “昨晚”, “今天”, or “昨天上午”, produce a realistic range that fits ordinary usage.',
|
|
331
|
+
'8. All output times must be ISO-like timestamps with timezone offsets.',
|
|
332
|
+
'9. Classify as past_point only when the user clearly points to a specific moment, for example “昨晚八点”, “昨天上午十点”, or “上周六晚上九点”.',
|
|
333
|
+
'10. If the user is asking about a duration or a whole period, it must be past_range, for example “昨晚在做什么”, “今天都忙了什么”, “最近有什么有趣的事吗”, or “这几天怎么样”.',
|
|
334
|
+
'11. “昨晚” by itself is not a point in time. It is an evening range. Only expressions with an explicit anchor such as “昨晚八点” are past_point.',
|
|
335
335
|
].join('\n');
|
|
336
336
|
}
|
|
337
337
|
function buildTimelineQueryPlannerMessage(input, anchor, requestId) {
|
|
338
338
|
return [
|
|
339
|
-
'
|
|
340
|
-
'
|
|
339
|
+
'Normalize time only from the information below.',
|
|
340
|
+
'Output a JSON object with the following shape:',
|
|
341
341
|
JSON.stringify({
|
|
342
342
|
schema_version: '1.0',
|
|
343
343
|
request_id: requestId,
|
|
344
344
|
target_time_range: 'now | past_point | past_range',
|
|
345
|
-
normalized_point: 'past_point
|
|
346
|
-
normalized_start: 'past_range
|
|
347
|
-
normalized_end: 'past_range
|
|
348
|
-
summary: '
|
|
345
|
+
normalized_point: 'required for past_point, omit otherwise',
|
|
346
|
+
normalized_start: 'required for past_range, omit otherwise',
|
|
347
|
+
normalized_end: 'required for past_range, omit otherwise',
|
|
348
|
+
summary: 'short summary of how you interpreted the user time semantics',
|
|
349
349
|
}, null, 2),
|
|
350
350
|
'',
|
|
351
351
|
'input:',
|
|
@@ -357,36 +357,36 @@ function buildTimelineQueryPlannerMessage(input, anchor, requestId) {
|
|
|
357
357
|
}
|
|
358
358
|
function buildTimelineReasonerSystemPrompt() {
|
|
359
359
|
return [
|
|
360
|
-
'
|
|
361
|
-
'
|
|
362
|
-
'
|
|
363
|
-
'
|
|
364
|
-
'1.
|
|
365
|
-
'2.
|
|
366
|
-
'3.
|
|
367
|
-
'4.
|
|
368
|
-
'5.
|
|
369
|
-
'6. continuity
|
|
370
|
-
'7. request_type
|
|
371
|
-
'8. continuity
|
|
372
|
-
'9. past_point
|
|
373
|
-
'10. past_range
|
|
374
|
-
'11.
|
|
375
|
-
'12.
|
|
376
|
-
'13. generated_fact
|
|
377
|
-
'14.
|
|
378
|
-
'15.
|
|
379
|
-
'16.
|
|
380
|
-
'17.
|
|
381
|
-
'18. MEMORY
|
|
382
|
-
'19.
|
|
383
|
-
'20.
|
|
384
|
-
'21.
|
|
385
|
-
'22.
|
|
386
|
-
'23.
|
|
387
|
-
'24.
|
|
388
|
-
'25.
|
|
389
|
-
'26.
|
|
360
|
+
'You are the internal Timeline plugin time-semantics reasoner.',
|
|
361
|
+
'Your only task is to use the collector fact bundle and output a JSON object that strictly matches TimelineReasonerOutput.',
|
|
362
|
+
'Do not call tools. Do not introduce pre-existing facts beyond the collector input. Do not output Markdown, explanations, or extra text.',
|
|
363
|
+
'You must follow these constraints:',
|
|
364
|
+
'1. Session hard facts and existing canon facts take priority over generation.',
|
|
365
|
+
'2. If collector.request.mode is read_only, you must never generate_new_fact.',
|
|
366
|
+
'3. If decision.action is reuse_existing_fact, selected_fact_id must come from candidate_facts.',
|
|
367
|
+
'4. If decision.action is generate_new_fact, you must provide a complete generated_fact and set should_write_canon=true.',
|
|
368
|
+
'5. Use return_empty only when the available information is insufficient and neither reuse nor generation is justified.',
|
|
369
|
+
'6. The continuity field must truthfully report whether continuity reasoning was used and why.',
|
|
370
|
+
'7. request_type must be one of now, past_point, or past_range.',
|
|
371
|
+
'8. continuity is not a separate request type. It is a reasoning result inside now or past_point queries.',
|
|
372
|
+
'9. past_point may hit either by exact match or by a prior fact that naturally continues to the target time.',
|
|
373
|
+
'10. For past_range, first understand the normalized range, then choose the most relevant, vivid, and worth-mentioning facts from that range.',
|
|
374
|
+
'11. If the user asks with semantic filters such as “有趣”, “好玩”, or “忙不忙”, interpret that filter first before deciding which fact to reuse or generate.',
|
|
375
|
+
'12. When generating a new fact for past_point or past_range, provide a reasonable timestamp that lands inside the target point or range instead of defaulting to the current moment.',
|
|
376
|
+
'13. generated_fact must contain structured fields only, with no free-form prose, explanation, or extra narration.',
|
|
377
|
+
'14. If collector.persona_context.should_constrain_generation=true, the new fact must explicitly respect the stable persona, tone, interests, habits, and long-term commitments described in SOUL / MEMORY / IDENTITY, and must not conflict with them.',
|
|
378
|
+
'15. When persona_context contains concrete persona signals, rationale.persona_basis must be non-empty and must name the specific persona signals used.',
|
|
379
|
+
'16. When persona_context contains concrete persona signals, rationale.constraint_basis must be non-empty and must name the long-term constraints that limited generation.',
|
|
380
|
+
'17. Do not generate generic, template-like daily scenes that could fit anyone. Let location, action, emotion, appearance, and internalMonologue reflect this persona\'s lived continuity.',
|
|
381
|
+
'18. Long-term preferences, relationships, life rhythm, and standing commitments from MEMORY are important constraints when weaving time memories. They are not time facts themselves, but they constrain what generation is believable.',
|
|
382
|
+
'19. You must also respect the real-world temporal logic in collector.world_context: meals, sleep, work/study, leisure, weekends, weekdays, and holidays should broadly fit ordinary life rhythm.',
|
|
383
|
+
'20. For late-night or pre-dawn generation, prefer sleep, rest, or quiet activities. For breakfast, lunch, or dinner scenes, keep the timestamp inside a plausible meal window. Do not generate scenes that obviously violate ordinary routine.',
|
|
384
|
+
'21. If decision.action is generate_new_fact, generated_fact.sceneSemantics must be fully populated to explain the activity type, how it relates to known same-day state, and why that judgment fits.',
|
|
385
|
+
'22. If decision.action is generate_new_fact, generated_fact.appearanceLogic must be fully populated to explain whether the day\'s outfit continues, whether a change is needed, why, and what outfit class results.',
|
|
386
|
+
'23. Appearance and clothing must depend on the concrete event itself rather than being generated independently. Exercise, bathing, sleep, formal outings, and buying/changing into new clothes are all strong appearance drivers.',
|
|
387
|
+
'24. If there is not enough reason for an outfit change, prefer same-day clothing continuity. Do not change appearance descriptions repeatedly within one day without cause.',
|
|
388
|
+
'25. For now queries, if collector.conversation_context.should_prefer_conversation_continuity_for_now=true, then “still continuing the just-active conversation with the user” should be treated as the highest-priority near-field reality.',
|
|
389
|
+
'26. If the current session is still inside the stickiness window, prefer interpreting the current state as continuing the recent topic, thinking about the last turn, or preparing a response, instead of jumping immediately to an unrelated off-thread life scene.',
|
|
390
390
|
].join('\n');
|
|
391
391
|
}
|
|
392
392
|
function setClock(parts, hour, minute = 0, second = 0) {
|
|
@@ -682,8 +682,8 @@ function createTimelineQueryPlanner(pluginApi, toolContext, runtimeConfig) {
|
|
|
682
682
|
}
|
|
683
683
|
function buildTimelineReasonerMessage(collector) {
|
|
684
684
|
return [
|
|
685
|
-
'
|
|
686
|
-
'
|
|
685
|
+
'Perform structured time reasoning using only the collector JSON below.',
|
|
686
|
+
'Output a JSON object matching TimelineReasonerOutput:',
|
|
687
687
|
JSON.stringify({
|
|
688
688
|
schema_version: '1.0',
|
|
689
689
|
request_id: collector.request_id,
|
|
@@ -698,7 +698,7 @@ function buildTimelineReasonerMessage(collector) {
|
|
|
698
698
|
},
|
|
699
699
|
decision: {
|
|
700
700
|
action: 'reuse_existing_fact | generate_new_fact | return_empty',
|
|
701
|
-
selected_fact_id: 'reuse_existing_fact
|
|
701
|
+
selected_fact_id: 'required when action is reuse_existing_fact',
|
|
702
702
|
should_write_canon: true,
|
|
703
703
|
},
|
|
704
704
|
continuity: {
|
|
@@ -684,7 +684,7 @@ async function timelineResolve(input, dependencyOverrides) {
|
|
|
684
684
|
}
|
|
685
685
|
exports.timelineResolveToolSpec = {
|
|
686
686
|
name: 'timeline_resolve',
|
|
687
|
-
description: '
|
|
687
|
+
description: 'Unified entry point for time-grounded reality and recall questions such as “你在干嘛”, “你现在在哪”, “最近有什么有趣的事吗”, or “昨晚八点你在做什么”. It accepts a natural-language query, interprets the time semantics internally, then retrieves or generates and append-only writes canon facts.',
|
|
688
688
|
inputSchema: {
|
|
689
689
|
type: 'object',
|
|
690
690
|
properties: {
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "stella-timeline-plugin",
|
|
3
|
-
"name": "Stella Timeline Plugin",
|
|
4
|
-
"version": "2.0.0",
|
|
5
|
-
"description": "OpenClaw timeline runtime with canonical timeline_resolve, LLM-based temporal reasoning, and guarded append-only writes.",
|
|
6
|
-
"entry": "dist/index.js",
|
|
7
|
-
"skills": [
|
|
8
|
-
"skills/timeline"
|
|
9
|
-
],
|
|
10
|
-
"configSchema": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"properties": {
|
|
13
|
-
"enableTrace": {
|
|
14
|
-
"type": "boolean",
|
|
15
|
-
"default": true,
|
|
16
|
-
"description": "Whether Timeline writes trace records for each runtime execution."
|
|
17
|
-
},
|
|
18
|
-
"traceLogPath": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "Optional trace log path. Relative paths are resolved from the workspace."
|
|
21
|
-
},
|
|
22
|
-
"canonicalMemoryRoot": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"description": "Root directory for canonical timeline daily logs. Relative paths are resolved from the workspace."
|
|
25
|
-
},
|
|
26
|
-
"reasonerTimeoutMs": {
|
|
27
|
-
"type": "integer",
|
|
28
|
-
"default": 90000,
|
|
29
|
-
"description": "Timeout for the internal timeline reasoner subagent, in milliseconds."
|
|
30
|
-
},
|
|
31
|
-
"reasonerSessionPrefix": {
|
|
32
|
-
"type": "string",
|
|
33
|
-
"default": "timeline-reasoner",
|
|
34
|
-
"description": "Session key prefix used for the internal timeline reasoner subagent."
|
|
35
|
-
},
|
|
36
|
-
"reasonerMessageLimit": {
|
|
37
|
-
"type": "integer",
|
|
38
|
-
"default": 24,
|
|
39
|
-
"description": "Maximum number of messages retained when reading the internal reasoner transcript."
|
|
40
|
-
},
|
|
41
|
-
"sessionHistoryLimit": {
|
|
42
|
-
"type": "integer",
|
|
43
|
-
"default": 12,
|
|
44
|
-
"description": "Maximum number of current-session messages retained by the collector."
|
|
45
|
-
},
|
|
46
|
-
"memorySearchMaxResults": {
|
|
47
|
-
"type": "integer",
|
|
48
|
-
"default": 6,
|
|
49
|
-
"description": "Maximum number of results requested when the collector calls OpenClaw memory_search."
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"additionalProperties": false
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "stella-timeline-plugin",
|
|
3
|
+
"name": "Stella Timeline Plugin",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"description": "OpenClaw timeline runtime with canonical timeline_resolve, LLM-based temporal reasoning, and guarded append-only writes.",
|
|
6
|
+
"entry": "dist/index.js",
|
|
7
|
+
"skills": [
|
|
8
|
+
"skills/timeline"
|
|
9
|
+
],
|
|
10
|
+
"configSchema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"enableTrace": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"default": true,
|
|
16
|
+
"description": "Whether Timeline writes trace records for each runtime execution."
|
|
17
|
+
},
|
|
18
|
+
"traceLogPath": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Optional trace log path. Relative paths are resolved from the workspace."
|
|
21
|
+
},
|
|
22
|
+
"canonicalMemoryRoot": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Root directory for canonical timeline daily logs. Relative paths are resolved from the workspace."
|
|
25
|
+
},
|
|
26
|
+
"reasonerTimeoutMs": {
|
|
27
|
+
"type": "integer",
|
|
28
|
+
"default": 90000,
|
|
29
|
+
"description": "Timeout for the internal timeline reasoner subagent, in milliseconds."
|
|
30
|
+
},
|
|
31
|
+
"reasonerSessionPrefix": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"default": "timeline-reasoner",
|
|
34
|
+
"description": "Session key prefix used for the internal timeline reasoner subagent."
|
|
35
|
+
},
|
|
36
|
+
"reasonerMessageLimit": {
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"default": 24,
|
|
39
|
+
"description": "Maximum number of messages retained when reading the internal reasoner transcript."
|
|
40
|
+
},
|
|
41
|
+
"sessionHistoryLimit": {
|
|
42
|
+
"type": "integer",
|
|
43
|
+
"default": 12,
|
|
44
|
+
"description": "Maximum number of current-session messages retained by the collector."
|
|
45
|
+
},
|
|
46
|
+
"memorySearchMaxResults": {
|
|
47
|
+
"type": "integer",
|
|
48
|
+
"default": 6,
|
|
49
|
+
"description": "Maximum number of results requested when the collector calls OpenClaw memory_search."
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"additionalProperties": false
|
|
53
|
+
}
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "stella-timeline-plugin",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Native OpenClaw timeline plugin with a canonical timeline_resolve tool, bundled skill routing, and guarded append-only writes.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"openclaw",
|
|
7
|
-
"skill",
|
|
8
|
-
"timeline",
|
|
9
|
-
"memory",
|
|
10
|
-
"ai-agent",
|
|
11
|
-
"episode",
|
|
12
|
-
"persona"
|
|
13
|
-
],
|
|
14
|
-
"author": "tao.zang",
|
|
15
|
-
"license": "MIT-0",
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/tower1229/Her"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://github.com/tower1229/Her#readme",
|
|
21
|
-
"bugs": {
|
|
22
|
-
"url": "https://github.com/tower1229/Her/issues"
|
|
23
|
-
},
|
|
24
|
-
"engines": {
|
|
25
|
-
"node": ">=22.0.0"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"prebuild": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
29
|
-
"build": "tsc -p tsconfig.build.json",
|
|
30
|
-
"typecheck": "tsc --noEmit",
|
|
31
|
-
"test": "node node_modules/jest/bin/jest.js --runInBand",
|
|
32
|
-
"test:unit": "node node_modules/jest/bin/jest.js --runInBand",
|
|
33
|
-
"test:smoke": "node ./scripts/run-openclaw-smoke.mjs",
|
|
34
|
-
"test:live-experience": "node ./scripts/run-openclaw-live-e2e.mjs",
|
|
35
|
-
"migrate:memory": "node ./scripts/migrate-existing-memory.mjs --apply",
|
|
36
|
-
"setup:workspace": "node ./scripts/setup-openclaw-workspace.mjs",
|
|
37
|
-
"doctor:workspace": "node ./scripts/doctor-openclaw-workspace.mjs",
|
|
38
|
-
"verify": "npm run typecheck && npm run build && npm run test:unit",
|
|
39
|
-
"pack:plugin": "npm pack",
|
|
40
|
-
"release": "node ./scripts/release.mjs"
|
|
41
|
-
},
|
|
42
|
-
"bin": {
|
|
43
|
-
"openclaw-timeline-setup": "./bin/openclaw-timeline-setup.mjs",
|
|
44
|
-
"openclaw-timeline-doctor": "./bin/openclaw-timeline-doctor.mjs"
|
|
45
|
-
},
|
|
46
|
-
"publishConfig": {
|
|
47
|
-
"access": "public"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@types/jest": "^30.0.0",
|
|
51
|
-
"@types/node": "^20.x",
|
|
52
|
-
"jest": "^29.x",
|
|
53
|
-
"ts-jest": "^29.x",
|
|
54
|
-
"typescript": "^5.x"
|
|
55
|
-
},
|
|
56
|
-
"main": "dist/index.js",
|
|
57
|
-
"files": [
|
|
58
|
-
"dist",
|
|
59
|
-
"bin",
|
|
60
|
-
"scripts",
|
|
61
|
-
"templates",
|
|
62
|
-
"skills",
|
|
63
|
-
"openclaw.plugin.json",
|
|
64
|
-
"LICENSE",
|
|
65
|
-
"README.md",
|
|
66
|
-
"README_ZH.md"
|
|
67
|
-
],
|
|
68
|
-
"openclaw": {
|
|
69
|
-
"extensions": [
|
|
70
|
-
"./dist/index.js"
|
|
71
|
-
]
|
|
72
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "stella-timeline-plugin",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "Native OpenClaw timeline plugin with a canonical timeline_resolve tool, bundled skill routing, and guarded append-only writes.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"openclaw",
|
|
7
|
+
"skill",
|
|
8
|
+
"timeline",
|
|
9
|
+
"memory",
|
|
10
|
+
"ai-agent",
|
|
11
|
+
"episode",
|
|
12
|
+
"persona"
|
|
13
|
+
],
|
|
14
|
+
"author": "tao.zang",
|
|
15
|
+
"license": "MIT-0",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/tower1229/Her"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/tower1229/Her#readme",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/tower1229/Her/issues"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22.0.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"prebuild": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
29
|
+
"build": "tsc -p tsconfig.build.json",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"test": "node node_modules/jest/bin/jest.js --runInBand",
|
|
32
|
+
"test:unit": "node node_modules/jest/bin/jest.js --runInBand",
|
|
33
|
+
"test:smoke": "node ./scripts/run-openclaw-smoke.mjs",
|
|
34
|
+
"test:live-experience": "node ./scripts/run-openclaw-live-e2e.mjs",
|
|
35
|
+
"migrate:memory": "node ./scripts/migrate-existing-memory.mjs --apply",
|
|
36
|
+
"setup:workspace": "node ./scripts/setup-openclaw-workspace.mjs",
|
|
37
|
+
"doctor:workspace": "node ./scripts/doctor-openclaw-workspace.mjs",
|
|
38
|
+
"verify": "npm run typecheck && npm run build && npm run test:unit",
|
|
39
|
+
"pack:plugin": "npm pack",
|
|
40
|
+
"release": "node ./scripts/release.mjs"
|
|
41
|
+
},
|
|
42
|
+
"bin": {
|
|
43
|
+
"openclaw-timeline-setup": "./bin/openclaw-timeline-setup.mjs",
|
|
44
|
+
"openclaw-timeline-doctor": "./bin/openclaw-timeline-doctor.mjs"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/jest": "^30.0.0",
|
|
51
|
+
"@types/node": "^20.x",
|
|
52
|
+
"jest": "^29.x",
|
|
53
|
+
"ts-jest": "^29.x",
|
|
54
|
+
"typescript": "^5.x"
|
|
55
|
+
},
|
|
56
|
+
"main": "dist/index.js",
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"bin",
|
|
60
|
+
"scripts",
|
|
61
|
+
"templates",
|
|
62
|
+
"skills",
|
|
63
|
+
"openclaw.plugin.json",
|
|
64
|
+
"LICENSE",
|
|
65
|
+
"README.md",
|
|
66
|
+
"README_ZH.md"
|
|
67
|
+
],
|
|
68
|
+
"openclaw": {
|
|
69
|
+
"extensions": [
|
|
70
|
+
"./dist/index.js"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
73
|
}
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import {
|
|
5
|
-
detectAgentsContract,
|
|
6
|
-
detectSoulContract,
|
|
7
|
-
normalizeRootName,
|
|
8
|
-
resolveCanonicalRootPath,
|
|
9
|
-
} from './workspace-contract.mjs';
|
|
10
|
-
|
|
11
|
-
function parseArgs(argv) {
|
|
12
|
-
const options = {
|
|
13
|
-
workspace: path.resolve(process.cwd()),
|
|
14
|
-
canonicalRootName: 'memory',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
for (let i = 0; i < argv.length; i += 1) {
|
|
18
|
-
const arg = argv[i];
|
|
19
|
-
if (arg === '--workspace') {
|
|
20
|
-
options.workspace = path.resolve(argv[++i] || '');
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (arg === '--canonical-root-name') {
|
|
24
|
-
options.canonicalRootName = normalizeRootName(argv[++i] || '');
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
if (arg === '--help' || arg === '-h') {
|
|
28
|
-
printHelp();
|
|
29
|
-
process.exit(0);
|
|
30
|
-
}
|
|
31
|
-
throw new Error(`Unknown argument: ${arg}`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return options;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function printHelp() {
|
|
38
|
-
console.log([
|
|
39
|
-
'Usage: openclaw-timeline-doctor [--workspace <dir>] [--canonical-root-name <name>]',
|
|
40
|
-
'',
|
|
41
|
-
'Checks whether the required Timeline workspace contracts are present.',
|
|
42
|
-
].join('\n'));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function readText(filePath) {
|
|
46
|
-
return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function check(label, passed, successDetail, failureDetail) {
|
|
50
|
-
const prefix = passed ? '[ok]' : '[missing]';
|
|
51
|
-
console.log(`${prefix} ${label}: ${passed ? successDetail : failureDetail}`);
|
|
52
|
-
return passed;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function main() {
|
|
56
|
-
const options = parseArgs(process.argv.slice(2));
|
|
57
|
-
const agentsPath = path.join(options.workspace, 'AGENTS.md');
|
|
58
|
-
const soulPath = path.join(options.workspace, 'SOUL.md');
|
|
59
|
-
const canonicalRootPath = resolveCanonicalRootPath(options.workspace, options.canonicalRootName);
|
|
60
|
-
|
|
61
|
-
const agentsContent = readText(agentsPath);
|
|
62
|
-
const soulContent = readText(soulPath);
|
|
63
|
-
|
|
64
|
-
let ok = true;
|
|
65
|
-
ok = check(
|
|
66
|
-
'AGENTS contract',
|
|
67
|
-
fs.existsSync(agentsPath) && detectAgentsContract(agentsContent),
|
|
68
|
-
agentsPath,
|
|
69
|
-
`${agentsPath} is missing the Timeline daily-log contract`,
|
|
70
|
-
) && ok;
|
|
71
|
-
ok = check(
|
|
72
|
-
'SOUL contract',
|
|
73
|
-
fs.existsSync(soulPath) && detectSoulContract(soulContent),
|
|
74
|
-
soulPath,
|
|
75
|
-
`${soulPath} is missing the Timeline recall contract`,
|
|
76
|
-
) && ok;
|
|
77
|
-
ok = check(
|
|
78
|
-
'Canonical memory root',
|
|
79
|
-
fs.existsSync(canonicalRootPath),
|
|
80
|
-
canonicalRootPath,
|
|
81
|
-
`${canonicalRootPath} does not exist`,
|
|
82
|
-
) && ok;
|
|
83
|
-
|
|
84
|
-
if (!ok) {
|
|
85
|
-
process.exitCode = 1;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
main();
|
|
91
|
-
} catch (error) {
|
|
92
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {
|
|
5
|
+
detectAgentsContract,
|
|
6
|
+
detectSoulContract,
|
|
7
|
+
normalizeRootName,
|
|
8
|
+
resolveCanonicalRootPath,
|
|
9
|
+
} from './workspace-contract.mjs';
|
|
10
|
+
|
|
11
|
+
function parseArgs(argv) {
|
|
12
|
+
const options = {
|
|
13
|
+
workspace: path.resolve(process.cwd()),
|
|
14
|
+
canonicalRootName: 'memory',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
18
|
+
const arg = argv[i];
|
|
19
|
+
if (arg === '--workspace') {
|
|
20
|
+
options.workspace = path.resolve(argv[++i] || '');
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (arg === '--canonical-root-name') {
|
|
24
|
+
options.canonicalRootName = normalizeRootName(argv[++i] || '');
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (arg === '--help' || arg === '-h') {
|
|
28
|
+
printHelp();
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`Unknown argument: ${arg}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function printHelp() {
|
|
38
|
+
console.log([
|
|
39
|
+
'Usage: openclaw-timeline-doctor [--workspace <dir>] [--canonical-root-name <name>]',
|
|
40
|
+
'',
|
|
41
|
+
'Checks whether the required Timeline workspace contracts are present.',
|
|
42
|
+
].join('\n'));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function readText(filePath) {
|
|
46
|
+
return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function check(label, passed, successDetail, failureDetail) {
|
|
50
|
+
const prefix = passed ? '[ok]' : '[missing]';
|
|
51
|
+
console.log(`${prefix} ${label}: ${passed ? successDetail : failureDetail}`);
|
|
52
|
+
return passed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function main() {
|
|
56
|
+
const options = parseArgs(process.argv.slice(2));
|
|
57
|
+
const agentsPath = path.join(options.workspace, 'AGENTS.md');
|
|
58
|
+
const soulPath = path.join(options.workspace, 'SOUL.md');
|
|
59
|
+
const canonicalRootPath = resolveCanonicalRootPath(options.workspace, options.canonicalRootName);
|
|
60
|
+
|
|
61
|
+
const agentsContent = readText(agentsPath);
|
|
62
|
+
const soulContent = readText(soulPath);
|
|
63
|
+
|
|
64
|
+
let ok = true;
|
|
65
|
+
ok = check(
|
|
66
|
+
'AGENTS contract',
|
|
67
|
+
fs.existsSync(agentsPath) && detectAgentsContract(agentsContent),
|
|
68
|
+
agentsPath,
|
|
69
|
+
`${agentsPath} is missing the Timeline daily-log contract`,
|
|
70
|
+
) && ok;
|
|
71
|
+
ok = check(
|
|
72
|
+
'SOUL contract',
|
|
73
|
+
fs.existsSync(soulPath) && detectSoulContract(soulContent),
|
|
74
|
+
soulPath,
|
|
75
|
+
`${soulPath} is missing the Timeline recall contract`,
|
|
76
|
+
) && ok;
|
|
77
|
+
ok = check(
|
|
78
|
+
'Canonical memory root',
|
|
79
|
+
fs.existsSync(canonicalRootPath),
|
|
80
|
+
canonicalRootPath,
|
|
81
|
+
`${canonicalRootPath} does not exist`,
|
|
82
|
+
) && ok;
|
|
83
|
+
|
|
84
|
+
if (!ok) {
|
|
85
|
+
process.exitCode = 1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
main();
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|