@fa-software/semi2-dsh 0.0.13 → 0.0.14-preview.20260922151653

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 (50) hide show
  1. package/README.md +20 -7
  2. package/lib/api/generated/documents.js +10 -1
  3. package/lib/api/generated/schema.js +2 -9
  4. package/lib/api/index.js +13 -0
  5. package/lib/client.js +54 -48
  6. package/lib/client.js.map +1 -1
  7. package/lib/contract.js +6 -0
  8. package/lib/domains/models/domain.js +11 -4
  9. package/lib/domains/models/web-search.js +61 -0
  10. package/lib/domains/redmine/domain.js +139 -0
  11. package/lib/domains/redmine/index.js +57 -0
  12. package/lib/domains/skills/candidates.js +4 -2
  13. package/lib/domains/skills/domain.js +5 -3
  14. package/lib/domains/workspace/domain.js +3 -2
  15. package/lib/hub/facts.js +1 -0
  16. package/lib/index.js +10 -11
  17. package/lib/service/audit.js +21 -7
  18. package/lib/service/config-service.js +9 -22
  19. package/lib/service/lifecycle.js +32 -34
  20. package/lib/service/namespaces.js +46 -16
  21. package/lib/service/ports.js +36 -13
  22. package/lib/service/publish.js +8 -8
  23. package/lib/service/registry.js +2 -0
  24. package/lib/service/sessions.js +90 -0
  25. package/lib/service/settings-sections.js +23 -62
  26. package/lib/types/api/generated/documents.d.ts +1 -1
  27. package/lib/types/api/generated/graphql.d.ts +27 -5
  28. package/lib/types/api/generated/schema.d.ts +265 -60
  29. package/lib/types/api/index.d.ts +13 -1
  30. package/lib/types/contract.d.ts +11 -0
  31. package/lib/types/domains/models/web-search.d.ts +8 -0
  32. package/lib/types/domains/redmine/domain.d.ts +59 -0
  33. package/lib/types/domains/redmine/index.d.ts +10 -0
  34. package/lib/types/domains/skills/domain.d.ts +1 -1
  35. package/lib/types/domains/types.d.ts +8 -2
  36. package/lib/types/hub/facts.d.ts +18 -0
  37. package/lib/types/index.d.ts +28 -24
  38. package/lib/types/service/audit.d.ts +10 -0
  39. package/lib/types/service/config-service.d.ts +3 -1
  40. package/lib/types/service/lifecycle.d.ts +5 -0
  41. package/lib/types/service/namespaces.d.ts +15 -17
  42. package/lib/types/service/ports.d.ts +19 -15
  43. package/lib/types/service/publish.d.ts +6 -1
  44. package/lib/types/service/sessions.d.ts +8 -0
  45. package/lib/types/service/settings-sections.d.ts +5 -14
  46. package/lib/types/web/routes.d.ts +4 -2
  47. package/lib/types/web/welcome-ack.d.ts +3 -3
  48. package/lib/web/routes.js +25 -1
  49. package/lib/web/welcome-ack.js +5 -5
  50. package/package.json +19 -11
@@ -26,12 +26,18 @@ export type Scalars = {
26
26
  input: string;
27
27
  output: string;
28
28
  };
29
- /** 自由形状的脱敏数据:仅审查日志的 detail 使用(服务端写入前已脱敏,只读不参与计算)。 */
29
+ /** 自由形状 JSON:日志脱敏快照与技能 metadata 等领域数据使用。 */
30
30
  JSON: {
31
31
  input: unknown;
32
32
  output: unknown;
33
33
  };
34
34
  };
35
+ /** 动作码选项:某本日志筛选下拉的选项来源(服务端注册表,前端不复制)。 */
36
+ export type ActionOption = {
37
+ __typename?: 'ActionOption';
38
+ action: Scalars['String']['output'];
39
+ label: Scalars['String']['output'];
40
+ };
35
41
  export type Activation = {
36
42
  __typename?: 'Activation';
37
43
  expiresAt: Scalars['DateTime']['output'];
@@ -41,13 +47,6 @@ export type AddCnbUsersInput = {
41
47
  /** 要预建账户的上游成员 CNB 用户 ID;本轮上游没返回的会被跳过。 */
42
48
  externalUserIds: Array<Scalars['String']['input']>;
43
49
  };
44
- /** 动作码选项:筛选下拉的选项来源(服务端注册表,前端不复制)。 */
45
- export type AuditActionOption = {
46
- __typename?: 'AuditActionOption';
47
- action: Scalars['String']['output'];
48
- category: AuditCategory;
49
- label: Scalars['String']['output'];
50
- };
51
50
  /** 身份来源:会话 / 用户密钥 / 接入密钥 / 匿名(登录失败、无效密钥)。 */
52
51
  export declare enum AuditActorKind {
53
52
  AccessKey = "ACCESS_KEY",
@@ -55,13 +54,6 @@ export declare enum AuditActorKind {
55
54
  Session = "SESSION",
56
55
  UserKey = "USER_KEY"
57
56
  }
58
- /** 审查类别:读 / 写 / 身份凭据 / 运行面生命周期。 */
59
- export declare enum AuditCategory {
60
- Auth = "AUTH",
61
- Read = "READ",
62
- Runtime = "RUNTIME",
63
- Write = "WRITE"
64
- }
65
57
  /** 来源面:控制台 / NPC / 云开发工作站 / 容器 Web / 宿主直跑 / 未标注。 */
66
58
  export declare enum AuditChannel {
67
59
  Console = "CONSOLE",
@@ -71,58 +63,103 @@ export declare enum AuditChannel {
71
63
  Unknown = "UNKNOWN",
72
64
  Workstation = "WORKSTATION"
73
65
  }
74
- export type AuditEvent = {
75
- __typename?: 'AuditEvent';
76
- /** 动作码,例 `write.project.delete`;闭集与中文文案由服务端的注册表给出。 */
66
+ /** 结果:SUCCESS = 完成;DENIED = 身份 / 权限 / 来源被拒;ERROR = 领域校验或冲突失败。 */
67
+ export declare enum AuditOutcome {
68
+ Denied = "DENIED",
69
+ Error = "ERROR",
70
+ Success = "SUCCESS"
71
+ }
72
+ /** 无会话事件筛选:被拒 / 失败的运行面读取与起会话之前的整体失败。 */
73
+ export type ClientEventFilter = {
74
+ /** 精确匹配动作码;选项清单走 clientActionOptions。 */
75
+ action?: InputMaybe<Scalars['String']['input']>;
76
+ actorUserId?: InputMaybe<Scalars['ID']['input']>;
77
+ channel?: InputMaybe<AuditChannel>;
78
+ from?: InputMaybe<Scalars['DateTime']['input']>;
79
+ outcome?: InputMaybe<AuditOutcome>;
80
+ to?: InputMaybe<Scalars['DateTime']['input']>;
81
+ };
82
+ /**
83
+ * 客户端会话:一次运行面会话一行(dsh 会话创建时建行、销毁时回填结束)。
84
+ * NPC 的一次任务先按任务引用建行,会话创建后再把 dsh 会话 id 补上。
85
+ */
86
+ export type ClientSession = {
87
+ __typename?: 'ClientSession';
88
+ actorDisplayName?: Maybe<Scalars['String']['output']>;
89
+ actorId?: Maybe<Scalars['ID']['output']>;
90
+ actorKind: AuditActorKind;
91
+ actorUsername?: Maybe<Scalars['String']['output']>;
92
+ channel: AuditChannel;
93
+ /** 运行面实例标识:同名 dsh 会话在不同容器里靠它分开。 */
94
+ clientId?: Maybe<Scalars['String']['output']>;
95
+ clientIp?: Maybe<Scalars['String']['output']>;
96
+ code?: Maybe<Scalars['String']['output']>;
97
+ /** 结束原因码(例 `dispose`)。 */
98
+ endReason?: Maybe<Scalars['String']['output']>;
99
+ /** 没有结束行(进程被强杀 / 容器停止)时为空。 */
100
+ endedAt?: Maybe<Scalars['DateTime']['output']>;
101
+ /** 本会话已记下的事件条数。 */
102
+ eventCount: Scalars['Int']['output'];
103
+ /** 行的稳定身份:优先任务引用,其次「客户端实例 + dsh 会话 id」。 */
104
+ key: Scalars['ID']['output'];
105
+ modelId?: Maybe<Scalars['String']['output']>;
106
+ /** 会话当下的结果:取最后一条事件的结果。 */
107
+ outcome: AuditOutcome;
108
+ /** 按工作区 / 任务引用解析出的项目;不可读时为空、只留展示名。 */
109
+ projectId?: Maybe<Scalars['ID']['output']>;
110
+ projectLabel?: Maybe<Scalars['String']['output']>;
111
+ reasoningLevel?: Maybe<Scalars['String']['output']>;
112
+ /** 任务引用 `<repo>#<issue|pr>#<iid>`。 */
113
+ runRef?: Maybe<Scalars['String']['output']>;
114
+ /** dsh 会话 id;会话尚未创建时为空(例:NPC 拒绝运行)。 */
115
+ sessionId?: Maybe<Scalars['String']['output']>;
116
+ startedAt: Scalars['DateTime']['output'];
117
+ workspacePath?: Maybe<Scalars['String']['output']>;
118
+ /** 会话 cwd 与命中的已登记工作区 slug。 */
119
+ workspaceSlug?: Maybe<Scalars['String']['output']>;
120
+ };
121
+ /** 会话时间线上的一条事件;`sessionKey` 为空 = 无会话归属的异常事实。 */
122
+ export type ClientSessionEvent = {
123
+ __typename?: 'ClientSessionEvent';
77
124
  action: Scalars['String']['output'];
78
- /** 动作码的中文文案(筛选下拉同样取自服务端,前端不复制这张表)。 */
79
125
  actionLabel: Scalars['String']['output'];
80
126
  actorDisplayName?: Maybe<Scalars['String']['output']>;
81
127
  actorId?: Maybe<Scalars['ID']['output']>;
82
128
  actorKind: AuditActorKind;
83
129
  actorUsername?: Maybe<Scalars['String']['output']>;
84
- category: AuditCategory;
85
130
  channel: AuditChannel;
86
131
  clientIp?: Maybe<Scalars['String']['output']>;
87
- /** 领域错误码或运行面原因码;成功(或被拒且无码)时为空。 */
88
132
  code?: Maybe<Scalars['String']['output']>;
89
- /** 脱敏快照:before / after、请求元信息、原因文本等。 */
90
133
  detail: Scalars['JSON']['output'];
91
134
  durationMs?: Maybe<Scalars['Int']['output']>;
92
135
  id: Scalars['ID']['output'];
93
136
  occurredAt: Scalars['DateTime']['output'];
94
137
  outcome: AuditOutcome;
138
+ sessionKey?: Maybe<Scalars['ID']['output']>;
95
139
  targetId?: Maybe<Scalars['String']['output']>;
96
- /** 目标当时的展示名(目标已删除时仍可读)。 */
97
140
  targetLabel?: Maybe<Scalars['String']['output']>;
98
- /** 目标类型,例 user / project / model / connection / skill / access-key / run。 */
99
141
  targetType?: Maybe<Scalars['String']['output']>;
100
142
  };
101
- /** 筛选:各条件并列(AND);from/to 为闭区间。 */
102
- export type AuditEventFilter = {
103
- /** 精确匹配动作码;选项清单走 auditActionOptions。 */
104
- action?: InputMaybe<Scalars['String']['input']>;
143
+ export type ClientSessionEventPage = {
144
+ __typename?: 'ClientSessionEventPage';
145
+ items: Array<ClientSessionEvent>;
146
+ total: Scalars['Int']['output'];
147
+ };
148
+ /** 客户端会话筛选:各条件并列(AND);from/to 为闭区间。 */
149
+ export type ClientSessionFilter = {
105
150
  actorUserId?: InputMaybe<Scalars['ID']['input']>;
106
- category?: InputMaybe<AuditCategory>;
107
151
  channel?: InputMaybe<AuditChannel>;
108
152
  from?: InputMaybe<Scalars['DateTime']['input']>;
109
153
  outcome?: InputMaybe<AuditOutcome>;
110
- targetId?: InputMaybe<Scalars['String']['input']>;
111
- targetType?: InputMaybe<Scalars['String']['input']>;
112
154
  to?: InputMaybe<Scalars['DateTime']['input']>;
155
+ /** 已登记工作区 slug(大小写不敏感,精确匹配)。 */
156
+ workspaceSlug?: InputMaybe<Scalars['String']['input']>;
113
157
  };
114
- export type AuditEventPage = {
115
- __typename?: 'AuditEventPage';
116
- items: Array<AuditEvent>;
117
- /** 与本次 filter 同口径的记录总数。 */
158
+ export type ClientSessionPage = {
159
+ __typename?: 'ClientSessionPage';
160
+ items: Array<ClientSession>;
118
161
  total: Scalars['Int']['output'];
119
162
  };
120
- /** 结果:SUCCESS = 完成;DENIED = 身份 / 权限 / 来源被拒;ERROR = 领域校验或冲突失败。 */
121
- export declare enum AuditOutcome {
122
- Denied = "DENIED",
123
- Error = "ERROR",
124
- Success = "SUCCESS"
125
- }
126
163
  /** CNB 接入密钥(Hub 生成、经 secret import 注入 CNB 环境;服务端只存摘要)。 */
127
164
  export type CnbAccessKey = {
128
165
  __typename?: 'CnbAccessKey';
@@ -232,6 +269,8 @@ export type EffectiveModelDefaults = {
232
269
  export type GlobalConfiguration = {
233
270
  __typename?: 'GlobalConfiguration';
234
271
  preferences: Preferences;
272
+ /** 组织共用的 Redmine 实例地址;null = 未配置(运行面不挂 Redmine 只读工具)。 */
273
+ redmineBaseUrl?: Maybe<Scalars['String']['output']>;
235
274
  revision: Scalars['Int']['output'];
236
275
  };
237
276
  export type ImportBuiltinModelsInput = {
@@ -414,10 +453,10 @@ export type Mutation = {
414
453
  /** 吊销接入密钥。 */
415
454
  revokeCnbAccessKey: Scalars['ID']['output'];
416
455
  /**
417
- * 回报一条运行面生命周期事实(会话启停 / 拒绝 / 交付分支与核对)。
456
+ * 回报一条运行面生命周期事实(会话起手 / 创建 / 销毁 / 拒绝 / 交付分支与核对)。
418
457
  * 上报失败不改变运行面行为:运行面按「只 warn 降级」处理,事件缺失不影响交付闭环。
419
458
  */
420
- runtimeReportEvent: AuditEvent;
459
+ runtimeReportEvent: ClientSessionEvent;
421
460
  saveGlobalConfiguration: GlobalConfiguration;
422
461
  saveModel: Model;
423
462
  saveModelConnection: ModelConnection;
@@ -538,6 +577,48 @@ export type MutationUpdateMyConfigurationArgs = {
538
577
  export type MutationWriteSkillFilesArgs = {
539
578
  input: WriteSkillFilesInput;
540
579
  };
580
+ /** 操作日志的一条事实:控制台的写操作与控制台敏感读。 */
581
+ export type OperationEvent = {
582
+ __typename?: 'OperationEvent';
583
+ /** 动作码,例 `write.project.delete`;闭集与中文文案由服务端的注册表给出。 */
584
+ action: Scalars['String']['output'];
585
+ /** 动作码的中文文案(筛选下拉同样取自服务端,前端不复制这张表)。 */
586
+ actionLabel: Scalars['String']['output'];
587
+ actorDisplayName?: Maybe<Scalars['String']['output']>;
588
+ actorId?: Maybe<Scalars['ID']['output']>;
589
+ actorKind: AuditActorKind;
590
+ actorUsername?: Maybe<Scalars['String']['output']>;
591
+ /** 领域错误码;成功(或被拒且无码)时为空。 */
592
+ code?: Maybe<Scalars['String']['output']>;
593
+ /** 脱敏快照:before / after、请求元信息、原因文本等。 */
594
+ detail: Scalars['JSON']['output'];
595
+ durationMs?: Maybe<Scalars['Int']['output']>;
596
+ id: Scalars['ID']['output'];
597
+ occurredAt: Scalars['DateTime']['output'];
598
+ outcome: AuditOutcome;
599
+ targetId?: Maybe<Scalars['String']['output']>;
600
+ /** 目标当时的展示名(目标已删除时仍可读)。 */
601
+ targetLabel?: Maybe<Scalars['String']['output']>;
602
+ /** 目标类型,例 user / project / model / connection / skill / access-key / run。 */
603
+ targetType?: Maybe<Scalars['String']['output']>;
604
+ };
605
+ /** 操作日志筛选:各条件并列(AND);from/to 为闭区间。 */
606
+ export type OperationEventFilter = {
607
+ /** 精确匹配动作码;选项清单走 operationActionOptions。 */
608
+ action?: InputMaybe<Scalars['String']['input']>;
609
+ actorUserId?: InputMaybe<Scalars['ID']['input']>;
610
+ from?: InputMaybe<Scalars['DateTime']['input']>;
611
+ outcome?: InputMaybe<AuditOutcome>;
612
+ targetId?: InputMaybe<Scalars['String']['input']>;
613
+ targetType?: InputMaybe<Scalars['String']['input']>;
614
+ to?: InputMaybe<Scalars['DateTime']['input']>;
615
+ };
616
+ export type OperationEventPage = {
617
+ __typename?: 'OperationEventPage';
618
+ items: Array<OperationEvent>;
619
+ /** 与本次 filter 同口径的记录总数。 */
620
+ total: Scalars['Int']['output'];
621
+ };
541
622
  export type Preferences = {
542
623
  __typename?: 'Preferences';
543
624
  defaultModelId?: Maybe<Scalars['ID']['output']>;
@@ -611,14 +692,16 @@ export type ProjectPage = {
611
692
  };
612
693
  export type Query = {
613
694
  __typename?: 'Query';
614
- /** 审查动作码清单(管理员):筛选下拉的选项来源。 */
615
- auditActionOptions: Array<AuditActionOption>;
616
- /** 审查日志(管理员):读取 / 写操作 / 身份凭据 / 运行面生命周期四类事实。 */
617
- auditEvents: AuditEventPage;
618
695
  /** 该用户可用模型(连接启用 + 模型启用 + 存在性 + 密钥齐备)。 */
619
696
  availableModels: Array<Model>;
620
697
  /** 该连接的内置目录模型清单;不需要密钥,上游读不到时的出路。 */
621
698
  builtinModelCatalog: Array<UpstreamModel>;
699
+ /** 客户端动作码清单(管理员):筛选下拉的选项来源。 */
700
+ clientActionOptions: Array<ActionOption>;
701
+ /** 某个会话的时间线(管理员):按时间正序的全部事件。 */
702
+ clientSessionTimeline: Array<ClientSessionEvent>;
703
+ /** 客户端会话(管理员):运行面会话,一会话一行。 */
704
+ clientSessions: ClientSessionPage;
622
705
  /** 全部 CNB 环境接入密钥(明文不回读)。密钥不绑用户,属部署级环境凭据。 */
623
706
  cnbAccessKeys: Array<CnbAccessKey>;
624
707
  /** 当前登录账户自己的 CNB 连接。 */
@@ -631,6 +714,10 @@ export type Query = {
631
714
  models: ModelPage;
632
715
  /** 登录者本人可访问的项目。 */
633
716
  myProjects: ProjectPage;
717
+ /** 操作动作码清单(管理员):筛选下拉的选项来源。 */
718
+ operationActionOptions: Array<ActionOption>;
719
+ /** 操作日志(管理员):控制台写操作与控制台敏感读。 */
720
+ operationEvents: OperationEventPage;
634
721
  /** 单项目详情;无访问权即 ACCESS_DENIED。 */
635
722
  project: Project;
636
723
  /** 全部项目;成员视角用 myProjects。 */
@@ -652,23 +739,37 @@ export type Query = {
652
739
  * 工作区逐个项目要,不必把整个项目表拉回本地。
653
740
  */
654
741
  runtimeProjects?: Maybe<Array<RuntimeProject>>;
742
+ /**
743
+ * 本面可用的 Redmine 地址与本人密钥;块内任一 null = 权威未配置(运行面不挂 Redmine 工具),
744
+ * 本次读取失败为 null。
745
+ */
746
+ runtimeRedmine?: Maybe<RuntimeRedmine>;
655
747
  /**
656
748
  * 自画像正文(agent 会话开头注入的人设);未配置为空串,本次读取失败为 null。
657
749
  * 全局一份,与读取者身份无关。
658
750
  */
659
751
  runtimeSelfPortrait?: Maybe<Scalars['String']['output']>;
752
+ /**
753
+ * 此刻对读取者生效的完整技能目录;至少一个调用面可用的未归档 head 都会返回。
754
+ * 调用策略由新 provider 原样交给 dsh,模型与用户目录在 dsh 边界分流。
755
+ */
756
+ runtimeSkillCatalog?: Maybe<Array<RuntimeSkill>>;
660
757
  /**
661
758
  * 某技能 head 版本的附件内容(运行面物化用);读取者对该技能不可见时返回空数组。
662
759
  * 字节不回填进 boot 文档,只在真正加载技能时按需取。
663
760
  */
664
761
  runtimeSkillFiles?: Maybe<Array<RuntimeSkillFileContent>>;
665
762
  /**
666
- * 此刻对读取者生效的技能目录(全局 + 可访问项目的未归档 head);失败为 null。
763
+ * 旧 runtime 兼容目录(全局 + 可访问项目的未归档 head);只含默认双开技能;失败为 null。
667
764
  * 「哪些目录算已登记工作区」是 client 侧事实,服务端只表达可访问性,不下发生效范围。
668
765
  */
669
766
  runtimeSkills?: Maybe<Array<RuntimeSkill>>;
670
767
  /** 本次读取者(服务器里当前用户);失败为 null。 */
671
768
  runtimeViewer?: Maybe<RuntimeViewer>;
769
+ /** 身份动作码清单(管理员):筛选下拉的选项来源。 */
770
+ securityActionOptions: Array<ActionOption>;
771
+ /** 身份安全(管理员):控制台身份与凭据事件。 */
772
+ securityEvents: SecurityEventPage;
672
773
  /** 自画像的当前版本(全局一份 agent 人设)。 */
673
774
  selfPortrait: SelfPortrait;
674
775
  /** 自画像的历史快照(新在前,最多 50 条)。 */
@@ -681,6 +782,8 @@ export type Query = {
681
782
  skillVersions: Array<SkillVersion>;
682
783
  /** 技能头版本列表;filter 决定作用域与状态。 */
683
784
  skills: SkillPage;
785
+ /** 无会话事件(管理员):被拒 / 失败的运行面读取与起会话之前的整体失败。 */
786
+ unassignedClientEvents: ClientSessionEventPage;
684
787
  /** 读令牌可见的 CNB 组织成员但不写库:返回列表供同步勾选;失败按 DomainError 码回。 */
685
788
  upstreamCnbMembers: Array<UpstreamCnbMember>;
686
789
  /** 读令牌可见的 CNB 仓库但不写库:返回列表供同步勾选;失败按 DomainError 码回。 */
@@ -696,17 +799,20 @@ export type Query = {
696
799
  users: UserPage;
697
800
  viewer: User;
698
801
  };
699
- export type QueryAuditEventsArgs = {
700
- filter?: InputMaybe<AuditEventFilter>;
701
- first?: InputMaybe<Scalars['Int']['input']>;
702
- offset?: InputMaybe<Scalars['Int']['input']>;
703
- };
704
802
  export type QueryAvailableModelsArgs = {
705
803
  userId?: InputMaybe<Scalars['ID']['input']>;
706
804
  };
707
805
  export type QueryBuiltinModelCatalogArgs = {
708
806
  connectionId: Scalars['ID']['input'];
709
807
  };
808
+ export type QueryClientSessionTimelineArgs = {
809
+ sessionKey: Scalars['ID']['input'];
810
+ };
811
+ export type QueryClientSessionsArgs = {
812
+ filter?: InputMaybe<ClientSessionFilter>;
813
+ first?: InputMaybe<Scalars['Int']['input']>;
814
+ offset?: InputMaybe<Scalars['Int']['input']>;
815
+ };
710
816
  export type QueryEffectiveModelDefaultsArgs = {
711
817
  userId?: InputMaybe<Scalars['ID']['input']>;
712
818
  };
@@ -728,6 +834,11 @@ export type QueryMyProjectsArgs = {
728
834
  first?: InputMaybe<Scalars['Int']['input']>;
729
835
  offset?: InputMaybe<Scalars['Int']['input']>;
730
836
  };
837
+ export type QueryOperationEventsArgs = {
838
+ filter?: InputMaybe<OperationEventFilter>;
839
+ first?: InputMaybe<Scalars['Int']['input']>;
840
+ offset?: InputMaybe<Scalars['Int']['input']>;
841
+ };
731
842
  export type QueryProjectArgs = {
732
843
  id: Scalars['ID']['input'];
733
844
  };
@@ -745,6 +856,11 @@ export type QueryRuntimeProjectsArgs = {
745
856
  export type QueryRuntimeSkillFilesArgs = {
746
857
  skillId: Scalars['ID']['input'];
747
858
  };
859
+ export type QuerySecurityEventsArgs = {
860
+ filter?: InputMaybe<SecurityEventFilter>;
861
+ first?: InputMaybe<Scalars['Int']['input']>;
862
+ offset?: InputMaybe<Scalars['Int']['input']>;
863
+ };
748
864
  export type QuerySkillArgs = {
749
865
  id: Scalars['ID']['input'];
750
866
  version?: InputMaybe<Scalars['Int']['input']>;
@@ -761,6 +877,11 @@ export type QuerySkillsArgs = {
761
877
  first?: InputMaybe<Scalars['Int']['input']>;
762
878
  offset?: InputMaybe<Scalars['Int']['input']>;
763
879
  };
880
+ export type QueryUnassignedClientEventsArgs = {
881
+ filter?: InputMaybe<ClientEventFilter>;
882
+ first?: InputMaybe<Scalars['Int']['input']>;
883
+ offset?: InputMaybe<Scalars['Int']['input']>;
884
+ };
764
885
  export type QueryUpstreamModelCatalogArgs = {
765
886
  connectionId: Scalars['ID']['input'];
766
887
  };
@@ -822,25 +943,39 @@ export type RuntimeConnection = {
822
943
  export declare enum RuntimeEventAction {
823
944
  DeliveryReady = "DELIVERY_READY",
824
945
  DeliveryVerified = "DELIVERY_VERIFIED",
825
- SessionEnd = "SESSION_END",
946
+ SessionCreated = "SESSION_CREATED",
947
+ SessionDisposed = "SESSION_DISPOSED",
826
948
  SessionFailed = "SESSION_FAILED",
827
949
  SessionRefused = "SESSION_REFUSED",
828
950
  SessionStart = "SESSION_START"
829
951
  }
830
952
  /**
831
953
  * 运行面上报:只接受用户密钥身份,动作码限闭集;detail 由服务端脱敏后落库。
832
- * 目标项目按 slug 解析:命中可读项目时 targetId 是项目 id,否则只留 slug 快照。
954
+ * 目标项目按 slug 解析:命中可读项目时挂项目 id,否则只留 slug 快照。
955
+ * 带会话身份(runRef 或 sessionId + clientId)的事件会折叠进同一行客户端会话。
833
956
  */
834
957
  export type RuntimeEventInput = {
835
958
  action: RuntimeEventAction;
836
- /** 原因码 / 交付状态码(例 SETUP_FAILED、delivered)。 */
959
+ /** 运行面实例标识(插件进程内生成):同名 dsh 会话在不同容器里靠它分开。 */
960
+ clientId?: InputMaybe<Scalars['String']['input']>;
961
+ /** 原因码 / 交付状态码(例 SETUP_FAILED、delivered、dispose)。 */
837
962
  code?: InputMaybe<Scalars['String']['input']>;
838
963
  detail?: InputMaybe<Scalars['JSON']['input']>;
964
+ /** 会话使用的模型与档位(拿不到留空)。 */
965
+ modelId?: InputMaybe<Scalars['String']['input']>;
839
966
  outcome: AuditOutcome;
840
- /** 项目 slug(CNB 仓库 slug 或工作区目录名),用于把事件挂到项目上。 */
967
+ /** 项目 slug(CNB 仓库 slug 或已登记工作区 slug),用于把事件挂到项目上。 */
841
968
  projectSlug?: InputMaybe<Scalars['String']['input']>;
969
+ reasoningLevel?: InputMaybe<Scalars['String']['input']>;
970
+ /** 任务引用 `<repo>#<issue|pr>#<iid>`:NPC 一次任务的稳定身份,会话尚未创建也带。 */
971
+ runRef?: InputMaybe<Scalars['String']['input']>;
972
+ /** dsh 会话 id(会话创建 / 销毁事件给出)。 */
973
+ sessionId?: InputMaybe<Scalars['String']['input']>;
842
974
  /** 目标展示名(例 `issue-12` / `PR #34`)。 */
843
975
  targetLabel?: InputMaybe<Scalars['String']['input']>;
976
+ /** 本次会话的 cwd 与命中的已登记工作区 slug。 */
977
+ workspacePath?: InputMaybe<Scalars['String']['input']>;
978
+ workspaceSlug?: InputMaybe<Scalars['String']['input']>;
844
979
  };
845
980
  /** 全局 headless 角色默认(plan / execute);读取失败时整个块为 null。 */
846
981
  export type RuntimeHeadlessModels = {
@@ -880,6 +1015,17 @@ export type RuntimeProject = {
880
1015
  planReasoningLevel?: Maybe<ReasoningLevel>;
881
1016
  slug: Scalars['String']['output'];
882
1017
  };
1018
+ /**
1019
+ * 运行面看到的 Redmine 事实:地址来自全局配置、密钥来自本人配置。
1020
+ * 块内任一为 null 即权威「未配置」;整块为 null 表示本次读取失败。
1021
+ */
1022
+ export type RuntimeRedmine = {
1023
+ __typename?: 'RuntimeRedmine';
1024
+ /** 本人 API Key;null = 本人还没配。运行面拿它起 Redmine 只读 MCP 服务。 */
1025
+ apiKey?: Maybe<Scalars['String']['output']>;
1026
+ /** 组织共用的 Redmine 地址;null = 管理员还没配。 */
1027
+ baseUrl?: Maybe<Scalars['String']['output']>;
1028
+ };
883
1029
  /** 运行面技能目录条目:此刻对读取者生效的未归档 head。 */
884
1030
  export type RuntimeSkill = {
885
1031
  __typename?: 'RuntimeSkill';
@@ -892,6 +1038,10 @@ export type RuntimeSkill = {
892
1038
  filesBytes: Scalars['Int']['output'];
893
1039
  /** 逻辑技能 id(provider 的 locator,跨版本稳定)。 */
894
1040
  id: Scalars['ID']['output'];
1041
+ /** 解析后的调用策略;provider 必须原样透传给 dsh。 */
1042
+ invocation: SkillInvocationPolicy;
1043
+ /** dsh 标准自由 metadata;null = frontmatter 未写键。 */
1044
+ metadata?: Maybe<Scalars['JSON']['output']>;
895
1045
  name: Scalars['String']['output'];
896
1046
  /** null = 全局技能;是否对本 cwd 生效由 client 按已登记工作区裁定。 */
897
1047
  projectId?: Maybe<Scalars['ID']['output']>;
@@ -926,6 +1076,8 @@ export type RuntimeViewer = {
926
1076
  export type SaveGlobalInput = {
927
1077
  expectedRevision: Scalars['Int']['input'];
928
1078
  preferences?: InputMaybe<PreferencesInput>;
1079
+ /** 组织共用的 Redmine 地址;省略 = 不改,null = 清除(必须是 https,development 下允许回环 http)。 */
1080
+ redmineBaseUrl?: InputMaybe<Scalars['String']['input']>;
929
1081
  };
930
1082
  export type SaveModelConnectionInput = {
931
1083
  apiKey?: InputMaybe<SecretInput>;
@@ -983,6 +1135,8 @@ export type SaveSkillInput = {
983
1135
  export type SaveUserInput = {
984
1136
  expectedRevision: Scalars['Int']['input'];
985
1137
  modelCredentials?: InputMaybe<Array<ModelCredentialInput>>;
1138
+ /** 本人 / 代设用户的 Redmine API Key:value 与 clear 二选一,省略 = 不改;设置时 hub 先验证。 */
1139
+ redmineApiKey?: InputMaybe<SecretInput>;
986
1140
  userId: Scalars['ID']['input'];
987
1141
  };
988
1142
  /** value / clear / reuse 严格三选一。reuse 仅连接密钥场景有意义。 */
@@ -991,6 +1145,38 @@ export type SecretInput = {
991
1145
  reuse?: InputMaybe<Scalars['Boolean']['input']>;
992
1146
  value?: InputMaybe<Scalars['String']['input']>;
993
1147
  };
1148
+ /** 身份安全的一条事实:控制台的身份与凭据事件。 */
1149
+ export type SecurityEvent = {
1150
+ __typename?: 'SecurityEvent';
1151
+ action: Scalars['String']['output'];
1152
+ actionLabel: Scalars['String']['output'];
1153
+ actorDisplayName?: Maybe<Scalars['String']['output']>;
1154
+ actorId?: Maybe<Scalars['ID']['output']>;
1155
+ actorKind: AuditActorKind;
1156
+ actorUsername?: Maybe<Scalars['String']['output']>;
1157
+ clientIp?: Maybe<Scalars['String']['output']>;
1158
+ /** 身份 / 权限 / 凭据错误码;成功时为空。 */
1159
+ code?: Maybe<Scalars['String']['output']>;
1160
+ detail: Scalars['JSON']['output'];
1161
+ id: Scalars['ID']['output'];
1162
+ occurredAt: Scalars['DateTime']['output'];
1163
+ outcome: AuditOutcome;
1164
+ userAgent?: Maybe<Scalars['String']['output']>;
1165
+ };
1166
+ /** 身份安全筛选:各条件并列(AND);from/to 为闭区间。 */
1167
+ export type SecurityEventFilter = {
1168
+ /** 精确匹配动作码;选项清单走 securityActionOptions。 */
1169
+ action?: InputMaybe<Scalars['String']['input']>;
1170
+ actorUserId?: InputMaybe<Scalars['ID']['input']>;
1171
+ from?: InputMaybe<Scalars['DateTime']['input']>;
1172
+ outcome?: InputMaybe<AuditOutcome>;
1173
+ to?: InputMaybe<Scalars['DateTime']['input']>;
1174
+ };
1175
+ export type SecurityEventPage = {
1176
+ __typename?: 'SecurityEventPage';
1177
+ items: Array<SecurityEvent>;
1178
+ total: Scalars['Int']['output'];
1179
+ };
994
1180
  /** 自画像的当前版本;从未配置过时 version = 0、content 为空串。 */
995
1181
  export type SelfPortrait = {
996
1182
  __typename?: 'SelfPortrait';
@@ -1003,7 +1189,7 @@ export type SelfPortrait = {
1003
1189
  /** 当前版本号;保存时作为 CAS 令牌(0 = 从未配置过)。 */
1004
1190
  version: Scalars['Int']['output'];
1005
1191
  };
1006
- /** 一个不可变历史快照;作者用扁平字段(同 AuditEvent 口径)。 */
1192
+ /** 一个不可变历史快照;作者用扁平字段(同日志事实口径)。 */
1007
1193
  export type SelfPortraitVersion = {
1008
1194
  __typename?: 'SelfPortraitVersion';
1009
1195
  content: Scalars['String']['output'];
@@ -1047,17 +1233,25 @@ export type Skill = {
1047
1233
  archived: Scalars['Boolean']['output'];
1048
1234
  content: Scalars['String']['output'];
1049
1235
  description: Scalars['String']['output'];
1236
+ /** frontmatter 原始值;null = 未写键。 */
1237
+ disableModelInvocation?: Maybe<Scalars['Boolean']['output']>;
1050
1238
  fileCount: Scalars['Int']['output'];
1051
1239
  /** 该版本的附件清单(随版本快照,由 skill_files 聚合)。 */
1052
1240
  files: Array<SkillFile>;
1053
1241
  filesBytes: Scalars['Int']['output'];
1054
1242
  /** 逻辑 id(跨版本稳定,即 skills.skill_id)。 */
1055
1243
  id: Scalars['ID']['output'];
1244
+ /** 解析后的调用策略;未写调用键即双开。 */
1245
+ invocation: SkillInvocationPolicy;
1246
+ /** dsh 标准自由 metadata;null = frontmatter 未写键。 */
1247
+ metadata?: Maybe<Scalars['JSON']['output']>;
1056
1248
  name: Scalars['String']['output'];
1057
1249
  /** null = 全局技能;文本工具与运行面按它分作用域。 */
1058
1250
  projectId?: Maybe<Scalars['ID']['output']>;
1059
1251
  /** head 行的 createdAt。 */
1060
1252
  updatedAt: Scalars['DateTime']['output'];
1253
+ /** frontmatter 原始值;null = 未写键。 */
1254
+ userInvocable?: Maybe<Scalars['Boolean']['output']>;
1061
1255
  /** 当前头版本号;保存时用 expectedVersion 做 CAS。 */
1062
1256
  version: Scalars['Int']['output'];
1063
1257
  whenToUse?: Maybe<Scalars['String']['output']>;
@@ -1101,13 +1295,19 @@ export type SkillFilter = {
1101
1295
  projectId?: InputMaybe<Scalars['ID']['input']>;
1102
1296
  search?: InputMaybe<Scalars['String']['input']>;
1103
1297
  };
1298
+ /** dsh 标准调用策略:模型工具与用户命令各自能否展示并加载该技能。 */
1299
+ export type SkillInvocationPolicy = {
1300
+ __typename?: 'SkillInvocationPolicy';
1301
+ modelInvocable: Scalars['Boolean']['output'];
1302
+ userInvocable: Scalars['Boolean']['output'];
1303
+ };
1104
1304
  export type SkillPage = {
1105
1305
  __typename?: 'SkillPage';
1106
1306
  items: Array<Skill>;
1107
1307
  /** 与本次 filter 同口径的技能总数。 */
1108
1308
  total: Scalars['Int']['output'];
1109
1309
  };
1110
- /** 一个不可变历史快照。作者用扁平字段(同 AuditEvent 口径),不构造完整 User。 */
1310
+ /** 一个不可变历史快照。作者用扁平字段(同日志事实口径),不构造完整 User。 */
1111
1311
  export type SkillVersion = {
1112
1312
  __typename?: 'SkillVersion';
1113
1313
  archived: Scalars['Boolean']['output'];
@@ -1136,6 +1336,8 @@ export type UpdateCnbTokenInput = {
1136
1336
  export type UpdateMyConfigurationInput = {
1137
1337
  expectedRevision: Scalars['Int']['input'];
1138
1338
  modelCredentials?: InputMaybe<Array<ModelCredentialInput>>;
1339
+ /** 本人 Redmine API Key:value 与 clear 二选一,省略 = 不改;设置时 hub 先验证。 */
1340
+ redmineApiKey?: InputMaybe<SecretInput>;
1139
1341
  };
1140
1342
  /** 令牌可见组织树里的一个成员:只读快照,不落库,供同步弹层勾选要添加的用户。 */
1141
1343
  export type UpstreamCnbMember = {
@@ -1183,7 +1385,8 @@ export type User = {
1183
1385
  createdAt: Scalars['DateTime']['output'];
1184
1386
  displayName: Scalars['String']['output'];
1185
1387
  id: Scalars['ID']['output'];
1186
- lastReadAt?: Maybe<Scalars['DateTime']['output']>;
1388
+ /** 该用户最近一次客户端会话的开始时间;从没开过会话时为 null。 */
1389
+ lastActivityAt?: Maybe<Scalars['DateTime']['output']>;
1187
1390
  /** users 行 revision;状态与角色集合修改都用它做 CAS。 */
1188
1391
  revision: Scalars['Int']['output'];
1189
1392
  /** 服务端聚合(计数 / 最近时间);仅管理员查询有值。 */
@@ -1197,6 +1400,8 @@ export type User = {
1197
1400
  /** user_configuration 一行的领域读模型。 */
1198
1401
  export type UserConfiguration = {
1199
1402
  __typename?: 'UserConfiguration';
1403
+ /** 本人是否已配置 Redmine API Key;明文永不回读。 */
1404
+ redmineApiKeyConfigured: Scalars['Boolean']['output'];
1200
1405
  revision: Scalars['Int']['output'];
1201
1406
  userId: Scalars['ID']['output'];
1202
1407
  };
@@ -29,7 +29,7 @@ export interface Semi2Api {
29
29
  }>;
30
30
  /** 密码登录换无会话用户密钥(密码只在本次请求内存里)。 */
31
31
  loginToConsole(input: ConsoleLoginInput): Promise<ConsoleLoginOutcome>;
32
- /** 运行面生命周期上报(会话启停 / 拒绝 / 交付);失败不改变运行面行为。 */
32
+ /** 运行面生命周期上报(会话起手 / 创建 / 销毁 / 拒绝 / 交付);失败不改变运行面行为。 */
33
33
  reportEvent(event: RuntimeEventReport): Promise<DomainOutcome<RuntimeReportedEvent>>;
34
34
  }
35
35
  /**
@@ -43,6 +43,18 @@ export interface RuntimeEventReport {
43
43
  projectSlug?: string;
44
44
  targetLabel?: string;
45
45
  detail?: Record<string, unknown>;
46
+ /** dsh 会话 id:会话创建 / 销毁事件给出,hub 按它折叠会话行。 */
47
+ sessionId?: string;
48
+ /** 运行面实例标识:同名 dsh 会话在不同容器里靠它分开。 */
49
+ clientId?: string;
50
+ /** 任务引用:NPC 一次任务的稳定身份(会话尚未创建的事件也带)。 */
51
+ runRef?: string;
52
+ /** 本面工作区:会话 cwd 与命中的已登记工作区 slug。 */
53
+ workspacePath?: string;
54
+ workspaceSlug?: string;
55
+ /** 会话使用的模型与档位。 */
56
+ modelId?: string;
57
+ reasoningLevel?: string;
46
58
  }
47
59
  export type RuntimeReportedEvent = RuntimeReportEventMutation['runtimeReportEvent'];
48
60
  export interface Semi2ApiOptions {
@@ -9,6 +9,12 @@ export declare const SEMI2_SECTION_ORDERS: {
9
9
  readonly cnbWorkstation: 3;
10
10
  };
11
11
  export type Semi2SectionKey = keyof typeof SEMI2_SECTION_ORDERS;
12
+ /**
13
+ * 插件自身设置段的条目 id:dsh 的设置命名空间就是 Profile 插件条目 id(bundle patch 里那一行的 id),
14
+ * 状态 / 健康 / 归属表 / 工作区映射都写在这一段里。host 与浏览器半边共用这一个常量
15
+ * (`cordis.patch.yml` 的插件行 id 必须与它一致,`test/dsh/unit/profile-patch.test.mjs` 对账)。
16
+ */
17
+ export declare const SEMI2_SETTINGS_ENTRY = "semi2-dsh";
12
18
  /** 只读 systemPrompt 的号段解析面:老宿主没有 `getSectionOrder` 时回落本表偏移。 */
13
19
  export interface SectionOrderSource {
14
20
  getSectionOrder?(name: string): number | undefined;
@@ -31,6 +37,11 @@ export interface Semi2Runtime {
31
37
  face: Semi2Face;
32
38
  /** semi2-hub 连接凭据;缺省 = 回落 dsh credentials 登录存储。 */
33
39
  credentials?: Semi2Credentials;
40
+ /**
41
+ * 本次运行的稳定引用(NPC 面 = `<仓库>#<issue|pr>#<号>`),由适配器解析触发后填。
42
+ * 客户端的会话日志按它把「起手 → 交付 → 会话 → 核对」并成一条:会话尚未创建的事件也带得上。
43
+ */
44
+ taskRef?: string;
34
45
  }
35
46
  /** cordis 服务名(适配器 provide / 插件 get 共用同一常量)。 */
36
47
  export declare const SEMI2_RUNTIME_SERVICE = "semi2Runtime";
@@ -0,0 +1,8 @@
1
+ import type { CompiledDeepSeek } from '../../hub/compile.js';
2
+ import type { DomainHost, LoadRun, RevertRun } from '../types.js';
3
+ /**
4
+ * 官方搜索默认解析 `DEEPSEEK_API_KEY`,而 hub 下发的是连接级引用;这里只对齐引用,
5
+ * 搜索端点与其他搜索配置仍归本地配置的所有者。
6
+ */
7
+ export declare function syncWebSearchKeyEnv(host: DomainHost, run: LoadRun, deepseek: CompiledDeepSeek | null): Promise<void>;
8
+ export declare function reclaimWebSearchKeyEnv(host: DomainHost, run: RevertRun): Promise<void>;