@fa-software/semi2-dsh 0.0.18 → 0.0.19-preview.20261001161030

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.
Files changed (67) hide show
  1. package/lib/api/bootstrap.js +45 -0
  2. package/lib/api/generated/http.js +1 -0
  3. package/lib/api/http-assets.js +89 -0
  4. package/lib/api/http-models.js +101 -0
  5. package/lib/api/http.js +99 -0
  6. package/lib/api/index.js +1 -72
  7. package/lib/api/login.js +3 -10
  8. package/lib/api/operations.js +9 -0
  9. package/lib/api/rest.js +57 -0
  10. package/lib/client.js.map +1 -1
  11. package/lib/cnb-token.js +37 -0
  12. package/lib/domains/default-model/domain.js +1 -3
  13. package/lib/domains/models/domain.js +3 -5
  14. package/lib/domains/models/web-search.js +2 -4
  15. package/lib/domains/project-profile/domain.js +1 -3
  16. package/lib/domains/project-profile/index.js +2 -2
  17. package/lib/domains/redmine/domain.js +1 -4
  18. package/lib/domains/redmine/index.js +2 -2
  19. package/lib/domains/secrets/domain.js +2 -6
  20. package/lib/domains/self-portrait/domain.js +1 -3
  21. package/lib/domains/self-portrait/index.js +1 -1
  22. package/lib/domains/skills/index.js +1 -1
  23. package/lib/domains/skills/mcp-resources.js +8 -10
  24. package/lib/domains/skills/provider.js +4 -4
  25. package/lib/domains/workspace/domain.js +3 -3
  26. package/lib/domains/workspace/feed.js +1 -1
  27. package/lib/domains/workspace/index.js +1 -1
  28. package/lib/domains/workspace/resolve.js +2 -4
  29. package/lib/hub/compile.js +5 -17
  30. package/lib/hub/credentials.js +3 -8
  31. package/lib/hub/errors.js +1 -3
  32. package/lib/hub/status.js +1 -1
  33. package/lib/hub/workspace-book.js +2 -6
  34. package/lib/index.js +3 -2
  35. package/lib/service/config-service.js +3 -4
  36. package/lib/service/connection.js +1 -1
  37. package/lib/service/lifecycle.js +3 -3
  38. package/lib/service/orchestrator.js +2 -4
  39. package/lib/service/ports.js +4 -4
  40. package/lib/service/registry.js +2 -8
  41. package/lib/service/sessions.js +5 -10
  42. package/lib/service/settings-tx.js +3 -6
  43. package/lib/service/status.js +4 -8
  44. package/lib/types/api/bootstrap.d.ts +23 -0
  45. package/lib/types/api/facts.d.ts +41 -0
  46. package/lib/types/api/generated/http.d.ts +3924 -0
  47. package/lib/types/api/http-assets.d.ts +65 -0
  48. package/lib/types/api/http-models.d.ts +68 -0
  49. package/lib/types/api/http.d.ts +16 -0
  50. package/lib/types/api/index.d.ts +10 -31
  51. package/lib/types/api/operations.d.ts +27 -0
  52. package/lib/types/api/rest.d.ts +3 -0
  53. package/lib/types/cnb-token.d.ts +24 -0
  54. package/lib/types/domains/project-profile/domain.d.ts +1 -1
  55. package/lib/types/hub/compile.d.ts +5 -5
  56. package/lib/types/index.d.ts +7 -5
  57. package/lib/types/service/config-service.d.ts +1 -1
  58. package/lib/web/action-routes.js +1 -3
  59. package/lib/web/index.js +2 -2
  60. package/lib/web/welcome-ack.js +6 -5
  61. package/package.json +3 -5
  62. package/lib/api/client.js +0 -119
  63. package/lib/api/generated/documents.js +0 -125
  64. package/lib/types/api/client.d.ts +0 -29
  65. package/lib/types/api/generated/documents.d.ts +0 -15
  66. package/lib/types/api/generated/graphql.d.ts +0 -184
  67. /package/lib/api/{generated/graphql.js → facts.js} +0 -0
@@ -1,125 +0,0 @@
1
- // @fa-software/semi2-dsh/api/generated/documents —— 由 scripts/gen-documents.ts 从
2
- // src/api/operations.graphql 生成,勿手改;操作文本与 codegen 的类型出同一份文件。
3
- /** 启动装配:五个用户级领域一个文档(项目绑定按工作区另行按需取)。 */
4
- export const RUNTIME_BOOT_DOCUMENT = `query RuntimeBoot {
5
- runtimeViewer {
6
- id
7
- username
8
- displayName
9
- }
10
- runtimeModels {
11
- id
12
- upstreamId
13
- displayName
14
- metadata { contextWindow maxTokens input reasoningLevels }
15
- defaultReasoningLevel
16
- connection { id provider protocol baseUrl }
17
- }
18
- runtimeDefaultModelId
19
- runtimeHeadlessModels {
20
- planModelId
21
- executeModelId
22
- }
23
- runtimeModelCredentials {
24
- connectionId
25
- value
26
- }
27
- runtimeSkillCatalog {
28
- id
29
- projectId
30
- name
31
- description
32
- whenToUse
33
- invocation {
34
- modelInvocable
35
- userInvocable
36
- }
37
- metadata
38
- content
39
- version
40
- files {
41
- path
42
- sizeBytes
43
- mimeType
44
- isExecutable
45
- }
46
- fileCount
47
- filesBytes
48
- }
49
- runtimeSelfPortrait
50
- runtimeRedmine {
51
- baseUrl
52
- apiKey
53
- }
54
- }`;
55
- /** 技能附属资源字节:boot 文档只带清单,真正加载某个技能时才按需取这一条。可空根字段:读取者不可见 / 不存在回空数组(权威「没有」),领域失败回 null(降级,不物化)。 */
56
- export const RUNTIME_SKILL_FILES_DOCUMENT = `query RuntimeSkillFiles($skillId: ID!) {
57
- runtimeSkillFiles(skillId: $skillId) {
58
- path
59
- content
60
- encoding
61
- sizeBytes
62
- mimeType
63
- isExecutable
64
- }
65
- }`;
66
- /** 项目绑定按 slug 取:只问已登记工作区命中的那几个项目,绝不把整张项目表拉回本地。`slugs` 是读范围之上的过滤(不是绕过),空数组 = 空集合。 */
67
- export const RUNTIME_WORKSPACE_PROJECTS_DOCUMENT = `query RuntimeWorkspaceProjects($slugs: [String!]) {
68
- runtimeProjects(slugs: $slugs) {
69
- id
70
- slug
71
- name
72
- enabled
73
- planModelId
74
- executeModelId
75
- planReasoningLevel
76
- executeReasoningLevel
77
- }
78
- }`;
79
- /** 项目画像:按 semi2 项目 id 取它关联的 Redmine 项目只读资料(用本人密钥在 hub 侧读取)。可空根字段:未关联返回空画像,读取失败回 null(本次不注入画像)。 */
80
- export const RUNTIME_PROJECT_PROFILE_DOCUMENT = `query RuntimeProjectProfile($projectId: ID!) {
81
- runtimeProjectProfile(projectId: $projectId) {
82
- projectName
83
- projectSlug
84
- redmineProjectId
85
- redmine {
86
- id
87
- identifier
88
- name
89
- status
90
- homepage
91
- description
92
- customFields {
93
- name
94
- value
95
- }
96
- truncated
97
- }
98
- }
99
- }`;
100
- /** 连接级模型密钥(连接列表变化时只刷新密钥)。 */
101
- export const RUNTIME_MODEL_CREDENTIALS_DOCUMENT = `query RuntimeModelCredentials($connectionIds: [ID!]) {
102
- runtimeModelCredentials(connectionIds: $connectionIds) {
103
- connectionId
104
- value
105
- }
106
- }`;
107
- /** 运行端生命周期上报(会话启停 / 拒绝 / 交付分支与核对):`action` 与 `outcome` 用 SDL 枚举名,失败只 warn 降级。 */
108
- export const RUNTIME_REPORT_EVENT_DOCUMENT = `mutation RuntimeReportEvent($input: RuntimeEventInput!) {
109
- runtimeReportEvent(input: $input) {
110
- id
111
- action
112
- outcome
113
- code
114
- occurredAt
115
- }
116
- }`;
117
- /** 全部操作名(契约测试用:领域声明的操作必须都在这里)。 */
118
- export const API_OPERATIONS = [
119
- 'RuntimeBoot',
120
- 'RuntimeSkillFiles',
121
- 'RuntimeWorkspaceProjects',
122
- 'RuntimeProjectProfile',
123
- 'RuntimeModelCredentials',
124
- 'RuntimeReportEvent',
125
- ];
@@ -1,29 +0,0 @@
1
- /** semi2-hub 根地址:生产/预览都是 https;development 下额外放行回环 http。 */
2
- export declare function consoleEndpoint(value: string, nodeEnv?: string): URL;
3
- export interface GraphqlClientOptions {
4
- /** semi2-hub GraphQL 端点(由连接凭据的地址构造)。 */
5
- endpoint: URL;
6
- token: string;
7
- /** CNB 端:环境创建者的外部用户 id(平台注入 CNB_BUILD_USER_ID),供 hub 决定读取身份。 */
8
- creator?: string;
9
- /** 本端标识(适配器在运行端契约里盖章):hub 审查日志据此区分来源。 */
10
- channel?: string;
11
- fetchImpl?: typeof fetch;
12
- }
13
- export interface GraphqlRequest {
14
- operationName: string;
15
- document: string;
16
- /** 省略即不带变量(GraphQL 把缺省变量当未提供)。 */
17
- variables?: Record<string, unknown>;
18
- }
19
- export interface GraphqlResponse<TData> {
20
- /** 信封里的 data;整份读取失败(含非空根字段错误向上传播)为 null。 */
21
- data: TData | null;
22
- /** `errors[].extensions.code` 的首个非空码;无错误为 null。 */
23
- errorCode: string | null;
24
- }
25
- /**
26
- * 传输层失败抛 `ConfigurationError`;服务端领域失败回落在返回值的 errorCode 上(HTTP 200 +
27
- * `errors[].extensions.code`),由调用方决定降级。
28
- */
29
- export declare function postGraphql<TData>(client: GraphqlClientOptions, request: GraphqlRequest): Promise<GraphqlResponse<TData>>;
@@ -1,15 +0,0 @@
1
- /** 启动装配:五个用户级领域一个文档(项目绑定按工作区另行按需取)。 */
2
- export declare const RUNTIME_BOOT_DOCUMENT = "query RuntimeBoot {\n runtimeViewer {\n id\n username\n displayName\n }\n runtimeModels {\n id\n upstreamId\n displayName\n metadata { contextWindow maxTokens input reasoningLevels }\n defaultReasoningLevel\n connection { id provider protocol baseUrl }\n }\n runtimeDefaultModelId\n runtimeHeadlessModels {\n planModelId\n executeModelId\n }\n runtimeModelCredentials {\n connectionId\n value\n }\n runtimeSkillCatalog {\n id\n projectId\n name\n description\n whenToUse\n invocation {\n modelInvocable\n userInvocable\n }\n metadata\n content\n version\n files {\n path\n sizeBytes\n mimeType\n isExecutable\n }\n fileCount\n filesBytes\n }\n runtimeSelfPortrait\n runtimeRedmine {\n baseUrl\n apiKey\n }\n}";
3
- /** 技能附属资源字节:boot 文档只带清单,真正加载某个技能时才按需取这一条。可空根字段:读取者不可见 / 不存在回空数组(权威「没有」),领域失败回 null(降级,不物化)。 */
4
- export declare const RUNTIME_SKILL_FILES_DOCUMENT = "query RuntimeSkillFiles($skillId: ID!) {\n runtimeSkillFiles(skillId: $skillId) {\n path\n content\n encoding\n sizeBytes\n mimeType\n isExecutable\n }\n}";
5
- /** 项目绑定按 slug 取:只问已登记工作区命中的那几个项目,绝不把整张项目表拉回本地。`slugs` 是读范围之上的过滤(不是绕过),空数组 = 空集合。 */
6
- export declare const RUNTIME_WORKSPACE_PROJECTS_DOCUMENT = "query RuntimeWorkspaceProjects($slugs: [String!]) {\n runtimeProjects(slugs: $slugs) {\n id\n slug\n name\n enabled\n planModelId\n executeModelId\n planReasoningLevel\n executeReasoningLevel\n }\n}";
7
- /** 项目画像:按 semi2 项目 id 取它关联的 Redmine 项目只读资料(用本人密钥在 hub 侧读取)。可空根字段:未关联返回空画像,读取失败回 null(本次不注入画像)。 */
8
- export declare const RUNTIME_PROJECT_PROFILE_DOCUMENT = "query RuntimeProjectProfile($projectId: ID!) {\n runtimeProjectProfile(projectId: $projectId) {\n projectName\n projectSlug\n redmineProjectId\n redmine {\n id\n identifier\n name\n status\n homepage\n description\n customFields {\n name\n value\n }\n truncated\n }\n }\n}";
9
- /** 连接级模型密钥(连接列表变化时只刷新密钥)。 */
10
- export declare const RUNTIME_MODEL_CREDENTIALS_DOCUMENT = "query RuntimeModelCredentials($connectionIds: [ID!]) {\n runtimeModelCredentials(connectionIds: $connectionIds) {\n connectionId\n value\n }\n}";
11
- /** 运行端生命周期上报(会话启停 / 拒绝 / 交付分支与核对):`action` 与 `outcome` 用 SDL 枚举名,失败只 warn 降级。 */
12
- export declare const RUNTIME_REPORT_EVENT_DOCUMENT = "mutation RuntimeReportEvent($input: RuntimeEventInput!) {\n runtimeReportEvent(input: $input) {\n id\n action\n outcome\n code\n occurredAt\n }\n}";
13
- /** 全部操作名(契约测试用:领域声明的操作必须都在这里)。 */
14
- export declare const API_OPERATIONS: readonly ["RuntimeBoot", "RuntimeSkillFiles", "RuntimeWorkspaceProjects", "RuntimeProjectProfile", "RuntimeModelCredentials", "RuntimeReportEvent"];
15
- export type ApiOperation = (typeof API_OPERATIONS)[number];
@@ -1,184 +0,0 @@
1
- /** Internal type. DO NOT USE DIRECTLY. */
2
- type Exact<T extends {
3
- [key: string]: unknown;
4
- }> = {
5
- [K in keyof T]: T[K];
6
- };
7
- /** Internal type. DO NOT USE DIRECTLY. */
8
- export type Incremental<T> = T | {
9
- [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never;
10
- };
11
- /** 结果:SUCCESS = 完成;DENIED = 身份 / 权限 / 来源被拒;ERROR = 领域校验或冲突失败。 */
12
- export type AuditOutcome = 'DENIED' | 'ERROR' | 'SUCCESS';
13
- export type InputModality = 'IMAGE' | 'TEXT';
14
- export type ModelProtocol = 'ANTHROPIC' | 'DEEPSEEK' | 'OPENAI_CHAT' | 'OPENAI_RESPONSES';
15
- export type ReasoningLevel = 'HIGH' | 'LOW' | 'MAX' | 'MEDIUM' | 'MINIMAL' | 'OFF' | 'XHIGH';
16
- /** 运行端可上报的动作:会话启停、拒绝、交付分支与交付核对。 */
17
- export type RuntimeEventAction = 'DELIVERY_READY' | 'DELIVERY_VERIFIED' | 'SESSION_CREATED' | 'SESSION_DISPOSED' | 'SESSION_FAILED' | 'SESSION_REFUSED' | 'SESSION_START';
18
- /**
19
- * 运行端上报:只接受用户密钥身份,动作码限闭集;detail 由服务端脱敏后落库。
20
- * 目标项目按 slug 解析:命中可读项目时挂项目 id,否则只留 slug 快照。
21
- * 带会话身份(runRef 或 sessionId + clientId)的事件会折叠进同一行客户端会话。
22
- */
23
- export type RuntimeEventInput = {
24
- action: RuntimeEventAction;
25
- /** 运行端实例标识(插件进程内生成):同名 dsh 会话在不同容器里靠它分开。 */
26
- clientId?: string | null | undefined;
27
- /** 原因码 / 交付状态码(例 SETUP_FAILED、delivered、dispose)。 */
28
- code?: string | null | undefined;
29
- detail?: unknown;
30
- /** 会话使用的模型与档位(拿不到留空)。 */
31
- modelId?: string | null | undefined;
32
- outcome: AuditOutcome;
33
- /** 项目 slug(CNB 仓库 slug 或已登记工作区 slug),用于把事件挂到项目上。 */
34
- projectSlug?: string | null | undefined;
35
- reasoningLevel?: string | null | undefined;
36
- /** 任务引用 `<repo>#<issue|pr>#<iid>`:NPC 一次任务的稳定身份,会话尚未创建也带。 */
37
- runRef?: string | null | undefined;
38
- /** dsh 会话 id(会话创建 / 销毁事件给出)。 */
39
- sessionId?: string | null | undefined;
40
- /** 目标展示名(例 `issue-12` / `PR #34`)。 */
41
- targetLabel?: string | null | undefined;
42
- /** 本次会话的 cwd 与命中的已登记工作区 slug。 */
43
- workspacePath?: string | null | undefined;
44
- workspaceSlug?: string | null | undefined;
45
- };
46
- /** 技能附件内容的编码:文本类用 UTF8,其余(图片 / 二进制)用 BASE64。 */
47
- export type SkillFileEncoding = 'BASE64' | 'UTF8';
48
- export type RuntimeBootQueryVariables = Exact<{
49
- [key: string]: never;
50
- }>;
51
- export type RuntimeBootQuery = {
52
- runtimeDefaultModelId: string | null;
53
- runtimeSelfPortrait: string | null;
54
- runtimeViewer: {
55
- id: string;
56
- username: string;
57
- displayName: string;
58
- } | null;
59
- runtimeModels: Array<{
60
- id: string;
61
- upstreamId: string;
62
- displayName: string | null;
63
- defaultReasoningLevel: ReasoningLevel | null;
64
- metadata: {
65
- contextWindow: number | null;
66
- maxTokens: number | null;
67
- input: Array<InputModality> | null;
68
- reasoningLevels: Array<ReasoningLevel> | null;
69
- };
70
- connection: {
71
- id: string;
72
- provider: string | null;
73
- protocol: ModelProtocol;
74
- baseUrl: string;
75
- };
76
- }> | null;
77
- runtimeHeadlessModels: {
78
- planModelId: string | null;
79
- executeModelId: string | null;
80
- } | null;
81
- runtimeModelCredentials: Array<{
82
- connectionId: string;
83
- value: string;
84
- }> | null;
85
- runtimeSkillCatalog: Array<{
86
- id: string;
87
- projectId: string | null;
88
- name: string;
89
- description: string;
90
- whenToUse: string | null;
91
- metadata: unknown;
92
- content: string;
93
- version: number;
94
- fileCount: number;
95
- filesBytes: number;
96
- invocation: {
97
- modelInvocable: boolean;
98
- userInvocable: boolean;
99
- };
100
- files: Array<{
101
- path: string;
102
- sizeBytes: number;
103
- mimeType: string;
104
- isExecutable: boolean;
105
- }>;
106
- }> | null;
107
- runtimeRedmine: {
108
- baseUrl: string | null;
109
- apiKey: string | null;
110
- } | null;
111
- };
112
- export type RuntimeSkillFilesQueryVariables = Exact<{
113
- skillId: string | number;
114
- }>;
115
- export type RuntimeSkillFilesQuery = {
116
- runtimeSkillFiles: Array<{
117
- path: string;
118
- content: string;
119
- encoding: SkillFileEncoding;
120
- sizeBytes: number;
121
- mimeType: string;
122
- isExecutable: boolean;
123
- }> | null;
124
- };
125
- export type RuntimeWorkspaceProjectsQueryVariables = Exact<{
126
- slugs?: Array<string> | string | null | undefined;
127
- }>;
128
- export type RuntimeWorkspaceProjectsQuery = {
129
- runtimeProjects: Array<{
130
- id: string;
131
- slug: string;
132
- name: string;
133
- enabled: boolean;
134
- planModelId: string | null;
135
- executeModelId: string | null;
136
- planReasoningLevel: ReasoningLevel | null;
137
- executeReasoningLevel: ReasoningLevel | null;
138
- }> | null;
139
- };
140
- export type RuntimeProjectProfileQueryVariables = Exact<{
141
- projectId: string | number;
142
- }>;
143
- export type RuntimeProjectProfileQuery = {
144
- runtimeProjectProfile: {
145
- projectName: string;
146
- projectSlug: string;
147
- redmineProjectId: number | null;
148
- redmine: {
149
- id: number;
150
- identifier: string;
151
- name: string;
152
- status: number;
153
- homepage: string | null;
154
- description: string | null;
155
- truncated: boolean;
156
- customFields: Array<{
157
- name: string;
158
- value: string;
159
- }>;
160
- } | null;
161
- } | null;
162
- };
163
- export type RuntimeModelCredentialsQueryVariables = Exact<{
164
- connectionIds?: Array<string | number> | string | number | null | undefined;
165
- }>;
166
- export type RuntimeModelCredentialsQuery = {
167
- runtimeModelCredentials: Array<{
168
- connectionId: string;
169
- value: string;
170
- }> | null;
171
- };
172
- export type RuntimeReportEventMutationVariables = Exact<{
173
- input: RuntimeEventInput;
174
- }>;
175
- export type RuntimeReportEventMutation = {
176
- runtimeReportEvent: {
177
- id: string;
178
- action: string;
179
- outcome: AuditOutcome;
180
- code: string | null;
181
- occurredAt: string;
182
- };
183
- };
184
- export {};
File without changes