@gencode/shared 0.0.20 → 0.1.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/CHANGELOG.md +27 -0
- package/README.md +84 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/session.d.ts +28 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +2 -0
- package/dist/session.js.map +1 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @gencode/shared
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bump patch version for npm publishing.
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 71b3e30: Add stable session metadata types to @gencode/shared, expand memory tool suite, and switch subagent spawn to synchronous result delivery.
|
|
14
|
+
|
|
15
|
+
- @gencode/shared: export `SessionSummary` and `SessionMetadata` types for cross-package use
|
|
16
|
+
- @gencode/agents: add memory_write, memory_log, memory_list, memory_forget, memory_update tools; improve memory tool descriptions and system prompt guidance; change subagent spawn from async acceptance to synchronous result return; suppress redundant assistant text after subagent completion
|
|
17
|
+
- @gencode/cli: update memory tool test coverage to match new tools
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 350b9d1: Add a publish-time changelog guard and include package changelogs in npm artifacts.
|
|
22
|
+
|
|
23
|
+
## 0.0.20
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Establish the initial changelog baseline for the current published package version.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @gencode/shared
|
|
2
|
+
|
|
3
|
+
## 包定位
|
|
4
|
+
|
|
5
|
+
`@gencode/shared` 负责跨包共享的稳定类型与协议定义。
|
|
6
|
+
它存在的目的,是防止 `agents`、`cli`、`web` 等包之间出现协议漂移和镜像定义。
|
|
7
|
+
|
|
8
|
+
## 负责内容
|
|
9
|
+
|
|
10
|
+
这个包适合承载:
|
|
11
|
+
- 稳定共享类型
|
|
12
|
+
- 被多个包复用的 request / response 协议结构
|
|
13
|
+
- callback payload 结构
|
|
14
|
+
- websocket 事件载荷结构
|
|
15
|
+
- 共享的 run-event / progress-event 定义
|
|
16
|
+
- HITL、UI-tool 等跨包共享契约
|
|
17
|
+
|
|
18
|
+
## 不负责内容
|
|
19
|
+
|
|
20
|
+
这个包不应包含:
|
|
21
|
+
- 包特定的运行时编排逻辑
|
|
22
|
+
- transport 副作用
|
|
23
|
+
- Web 服务行为
|
|
24
|
+
- CLI 命令逻辑
|
|
25
|
+
- agent 领域逻辑
|
|
26
|
+
|
|
27
|
+
## 当前源码入口
|
|
28
|
+
|
|
29
|
+
阅读本包时,建议先看:
|
|
30
|
+
- `src/index.ts` —— 对外导出入口
|
|
31
|
+
- `src/agent-progress.ts`
|
|
32
|
+
- `src/context-protocol.ts`
|
|
33
|
+
- `src/hitl.ts`
|
|
34
|
+
- `src/run-events.ts`
|
|
35
|
+
- `src/ui-tool.ts`
|
|
36
|
+
|
|
37
|
+
当前测试包括:
|
|
38
|
+
- `src/agent-progress.test.ts`
|
|
39
|
+
- `src/context-protocol.test.ts`
|
|
40
|
+
- `src/hitl.test.ts`
|
|
41
|
+
- `src/run-events.test.ts`
|
|
42
|
+
- `src/ui-tool.test.ts`
|
|
43
|
+
|
|
44
|
+
当 `dist/` 存在时,应将其视为构建输出,而不是源码事实来源。
|
|
45
|
+
|
|
46
|
+
## 与其他包的关系
|
|
47
|
+
|
|
48
|
+
- 当 `@gencode/agents` 的内部结果需要对外形成稳定共享结构时,应优先使用本包
|
|
49
|
+
- `@gencode/cli` 应尽量消费本包中的共享协议,而不是本地重新定义
|
|
50
|
+
- `@gencode/web` 在消费 CLI 输出时,也应尽量与本包中的契约保持一致
|
|
51
|
+
|
|
52
|
+
## 开发说明
|
|
53
|
+
|
|
54
|
+
一个类型或协议通常应该放在这里,当它满足以下条件之一:
|
|
55
|
+
- 被多个包共同依赖
|
|
56
|
+
- 描述了稳定的跨包契约
|
|
57
|
+
- 若出现镜像定义,漂移风险较高
|
|
58
|
+
|
|
59
|
+
一个类型通常不应放在这里,当它:
|
|
60
|
+
- 只在单个包内使用
|
|
61
|
+
- 仅服务于某个内部实现细节
|
|
62
|
+
- 附带运行时行为,而不是共享结构
|
|
63
|
+
|
|
64
|
+
## 验证
|
|
65
|
+
|
|
66
|
+
在工作区根目录可运行:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm -C source/packages/shared test
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
工作区级验证:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pnpm -C source typecheck
|
|
76
|
+
pnpm -C source test
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 相关规格文档
|
|
80
|
+
|
|
81
|
+
- `../../../specs/system-overview.md`
|
|
82
|
+
- `../../../specs/architecture-boundaries.md`
|
|
83
|
+
- `../../../specs/repo-map.md`
|
|
84
|
+
- `../../../specs/implementation-backlog.md`
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { isAgentDiagnosticEvent } from "./agent-progress.js";
|
|
|
5
5
|
export { formatTaskForDisplay } from "./task-display.js";
|
|
6
6
|
export type { AgentCustomProgressEvent, AgentDiagnosticEvent, AgentDiagnosticLevel, AgentDiagnosticScope, AgentProgressEvent, AgentProgressEventBase, } from "./agent-progress.js";
|
|
7
7
|
export type { CallbackEventPayload, Channel, RunResultPayload, StreamEnvelope, StreamEventName, } from "./run-events.js";
|
|
8
|
+
export type { SessionMetadata, SessionSummary } from "./session.js";
|
|
8
9
|
export type { CollapseSpan, CompressionLayer, ContextCompactionState, ModelUsageCheckpoint, ReadStateRecord, SessionMemorySnapshot, SessionContextSnapshot, SnipRecord, ToolResultReference, ToolResultBudgetRecord, } from "./context-protocol.js";
|
|
9
10
|
export { isHitlPending, isHitlResolved, isHitlExpired, isHitlTool, HITL_TOOL_NAMES, parseMatchedTextToResolution, parseTextToResolution, } from "./hitl.js";
|
|
10
11
|
export type { HitlKind, HitlChoice, HitlChoiceInput, HitlTextInput, HitlFormInput, HitlInputSchema, HitlPreview, HitlPolicy, HitlRequest, HitlResolution, HitlCheckpointPhase, HitlCheckpoint, HitlToolContext, HitlStatus, PausedRunState, HitlHistoryEntry, } from "./hitl.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,oBAAoB,EACpB,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACV,eAAe,EACf,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACV,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,UAAU,EACV,cAAc,EACd,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EACV,WAAW,EACX,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,oBAAoB,EACpB,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACV,eAAe,EACf,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACV,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,UAAU,EACV,cAAc,EACd,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EACV,WAAW,EACX,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AA8BzD,sBAAsB;AACtB,OAAO,EACL,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACV,eAAe,EACf,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAoBnB,yBAAyB;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Channel } from "./run-events.js";
|
|
2
|
+
/**
|
|
3
|
+
* Stable cross-package session summary shape.
|
|
4
|
+
*
|
|
5
|
+
* This type is intended for list / query / display scenarios shared across
|
|
6
|
+
* packages such as agents, cli, and future web integrations.
|
|
7
|
+
*/
|
|
8
|
+
export type SessionSummary = {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
channel: Channel;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Stable cross-package session metadata record.
|
|
17
|
+
*
|
|
18
|
+
* This type represents the canonical persisted metadata envelope for a session
|
|
19
|
+
* without including transcript, context snapshot, or export-specific payloads.
|
|
20
|
+
*/
|
|
21
|
+
export type SessionMetadata = {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
channel: Channel;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
package/dist/session.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gencode/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./config": {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"CHANGELOG.md"
|
|
17
18
|
],
|
|
18
19
|
"publishConfig": {
|
|
19
20
|
"access": "public"
|