@wowyuarm/dsh-agent-team 0.1.14 → 0.2.0

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 (102) hide show
  1. package/README.md +8 -4
  2. package/README.zh.md +8 -4
  3. package/cordis.patch.yml +187 -2
  4. package/package.json +52 -51
  5. package/packages/agent-team/README.md +1 -1
  6. package/packages/agent-team/README.zh.md +1 -1
  7. package/packages/agent-team/lib/context-continuity-host.js +2 -3
  8. package/packages/agent-team/lib/context-projection.js +3 -3
  9. package/packages/agent-team/lib/context-source.js +39 -13
  10. package/packages/agent-team/lib/environment-check.js +102 -0
  11. package/packages/agent-team/lib/human-profile.js +110 -13
  12. package/packages/agent-team/lib/index.js +192 -100
  13. package/packages/agent-team/lib/installed-manifest.js +32 -0
  14. package/packages/agent-team/lib/ledger.js +35 -0
  15. package/packages/agent-team/lib/member-context.js +3 -3
  16. package/packages/agent-team/lib/member-time-context.js +3 -2
  17. package/packages/agent-team/lib/pressure-policy.js +18 -11
  18. package/packages/agent-team/lib/stored-session-reader.js +1 -2
  19. package/packages/agent-team/lib/typert.host.js +479 -260
  20. package/packages/agent-team/lib/typert.remote-client.d.ts +8 -3
  21. package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
  22. package/packages/agent-team/lib/typert.remote-client.js +375 -228
  23. package/packages/agent-team/lib/types/context-continuity-host.d.ts.map +1 -1
  24. package/packages/agent-team/lib/types/context-source.d.ts +49 -13
  25. package/packages/agent-team/lib/types/context-source.d.ts.map +1 -1
  26. package/packages/agent-team/lib/types/environment-check.d.ts +66 -0
  27. package/packages/agent-team/lib/types/environment-check.d.ts.map +1 -0
  28. package/packages/agent-team/lib/types/human-profile.d.ts +87 -21
  29. package/packages/agent-team/lib/types/human-profile.d.ts.map +1 -1
  30. package/packages/agent-team/lib/types/index.d.ts +85 -26
  31. package/packages/agent-team/lib/types/index.d.ts.map +1 -1
  32. package/packages/agent-team/lib/types/installed-manifest.d.ts +16 -0
  33. package/packages/agent-team/lib/types/installed-manifest.d.ts.map +1 -0
  34. package/packages/agent-team/lib/types/ledger.d.ts +12 -0
  35. package/packages/agent-team/lib/types/ledger.d.ts.map +1 -1
  36. package/packages/agent-team/lib/types/member-context.d.ts +14 -0
  37. package/packages/agent-team/lib/types/member-context.d.ts.map +1 -1
  38. package/packages/agent-team/lib/types/member-time-context.d.ts +15 -0
  39. package/packages/agent-team/lib/types/member-time-context.d.ts.map +1 -1
  40. package/packages/agent-team/lib/types/pressure-policy.d.ts +5 -1
  41. package/packages/agent-team/lib/types/pressure-policy.d.ts.map +1 -1
  42. package/packages/agent-team/lib/types/stored-session-reader.d.ts +1 -2
  43. package/packages/agent-team/lib/types/stored-session-reader.d.ts.map +1 -1
  44. package/packages/agent-team/lib/types/types/entities.d.ts +1 -8
  45. package/packages/agent-team/lib/types/types/entities.d.ts.map +1 -1
  46. package/packages/agent-team/lib/types/types/requests-results.d.ts +84 -0
  47. package/packages/agent-team/lib/types/types/requests-results.d.ts.map +1 -1
  48. package/packages/client-agent-team/README.md +1 -1
  49. package/packages/client-agent-team/README.zh.md +1 -1
  50. package/packages/client-agent-team/lib/client.js +615 -275
  51. package/packages/client-agent-team/lib/client.js.map +1 -1
  52. package/packages/client-agent-team/lib/types/client/EnvironmentCheck.d.ts +18 -0
  53. package/packages/client-agent-team/lib/types/client/EnvironmentCheck.d.ts.map +1 -0
  54. package/packages/client-agent-team/lib/types/client/EnvironmentCheck.js +58 -0
  55. package/packages/client-agent-team/lib/types/client/HumanSettingsSection.d.ts +3 -0
  56. package/packages/client-agent-team/lib/types/client/HumanSettingsSection.d.ts.map +1 -1
  57. package/packages/client-agent-team/lib/types/client/HumanSettingsSection.js +7 -4
  58. package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +6 -11
  59. package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +3 -3
  60. package/packages/client-agent-team/lib/types/client/TeamChannelsPanel.js +4 -4
  61. package/packages/client-agent-team/lib/types/client/TeamComposer.js +3 -3
  62. package/packages/client-agent-team/lib/types/client/TeamFooterAction.js +2 -2
  63. package/packages/client-agent-team/lib/types/client/TeamMemberEditor.js +3 -3
  64. package/packages/client-agent-team/lib/types/client/TeamMembersAction.js +2 -2
  65. package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts.map +1 -1
  66. package/packages/client-agent-team/lib/types/client/TeamMessage.js +1 -1
  67. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts +1 -1
  68. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts.map +1 -1
  69. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.js +2 -7
  70. package/packages/client-agent-team/lib/types/client/TeamRowMenu.d.ts.map +1 -1
  71. package/packages/client-agent-team/lib/types/client/TeamRowMenu.js +2 -2
  72. package/packages/client-agent-team/lib/types/client/TeamSidebarSection.js +2 -2
  73. package/packages/client-agent-team/lib/types/client/TeamThreadPage.js +3 -3
  74. package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.js +3 -3
  75. package/packages/client-agent-team/lib/types/client/TeamWorkspaceSelector.js +2 -2
  76. package/packages/client-agent-team/lib/types/client/environment-check.d.ts +65 -0
  77. package/packages/client-agent-team/lib/types/client/environment-check.d.ts.map +1 -0
  78. package/packages/client-agent-team/lib/types/client/environment-check.js +78 -0
  79. package/packages/client-agent-team/lib/types/client/human-identity.d.ts +4 -8
  80. package/packages/client-agent-team/lib/types/client/human-identity.d.ts.map +1 -1
  81. package/packages/client-agent-team/lib/types/client/human-identity.js +0 -21
  82. package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
  83. package/packages/client-agent-team/lib/types/client/index.js +59 -49
  84. package/packages/client-agent-team/lib/types/client/locales.d.ts +18 -8
  85. package/packages/client-agent-team/lib/types/client/locales.d.ts.map +1 -1
  86. package/packages/client-agent-team/lib/types/client/locales.js +21 -8
  87. package/packages/client-agent-team/lib/types/client/multi-menu-field.js +2 -2
  88. package/packages/client-agent-team/lib/types/client/slots.d.ts +1 -1
  89. package/packages/tool-agent-team/README.md +1 -1
  90. package/packages/tool-agent-team/README.zh.md +1 -1
  91. package/packages/tool-agent-team/lib/context-tools.js +106 -94
  92. package/packages/tool-agent-team/lib/index.js +17 -2
  93. package/packages/tool-agent-team/lib/types/context-tools.d.ts +16 -7
  94. package/packages/tool-agent-team/lib/types/context-tools.d.ts.map +1 -1
  95. package/packages/tool-agent-team/lib/types/index.d.ts.map +1 -1
  96. package/packages/agent-team/lib/preset-roster.js +0 -15
  97. package/packages/agent-team/lib/session-remediation.js +0 -493
  98. package/packages/agent-team/lib/types/preset-roster.d.ts +0 -5
  99. package/packages/agent-team/lib/types/preset-roster.d.ts.map +0 -1
  100. package/packages/agent-team/lib/types/session-remediation.d.ts +0 -172
  101. package/packages/agent-team/lib/types/session-remediation.d.ts.map +0 -1
  102. package/packages/agent-team/preset/team-member/agent.cordis.yml +0 -166
@@ -0,0 +1,102 @@
1
+ /** The one local environment check: how the running DSH compares to the line this bundle declares. */
2
+ import { evaluatePluginCompatibility, getDshRuntimeVersion } from '@deepseek-ai/dsh-app-boot';
3
+ import { bundleVersionOf, readInstalledManifest } from "./installed-manifest.js";
4
+ /** Prefix of every peer that sits on the DSH version line; the bare scope is not one. */
5
+ const DSH_PEER_PREFIX = '@deepseek-ai/dsh-';
6
+ /** The `>=lower <upper>` shape every DSH peer carries; a comparator series, not a single version. */
7
+ const SUPPORT_RANGE_SHAPE = /^>=(\S+)\s+<(\S+)$/u;
8
+ /**
9
+ * Read the support line from the installed manifest's DSH peers, or nothing.
10
+ *
11
+ * Every `@deepseek-ai/dsh-*` peer must carry exactly the same range, and it must
12
+ * be a `>=<lower> <upper>` series: the version line is the manifest's own claim
13
+ * and a partially drifted manifest cannot state one. `scripts/check-version-consistency.mjs`
14
+ * holds the same shape to the certified baseline, so a run of this bundle
15
+ * states the same line its README does. Returns `undefined` when the peers
16
+ * disagree or the shape is unreadable.
17
+ */
18
+ export function supportRangeOf(manifest) {
19
+ const fields = manifest;
20
+ if (typeof fields.peerDependencies !== 'object' || fields.peerDependencies === null)
21
+ return undefined;
22
+ const ranges = new Set();
23
+ for (const [name, range] of Object.entries(fields.peerDependencies)) {
24
+ if (!name.startsWith(DSH_PEER_PREFIX))
25
+ continue;
26
+ if (typeof range !== 'string')
27
+ return undefined;
28
+ ranges.add(range);
29
+ }
30
+ const distinct = [...ranges];
31
+ if (distinct.length !== 1)
32
+ return undefined;
33
+ const shape = SUPPORT_RANGE_SHAPE.exec(distinct[0]);
34
+ if (shape === null)
35
+ return undefined;
36
+ return Object.freeze({ lower: shape[1], upper: shape[2] });
37
+ }
38
+ /**
39
+ * Judge one already-resolved triple, so every branch is testable without an
40
+ * environment. The verdict comes from the Harness's own
41
+ * `evaluatePluginCompatibility` — the plugin manager decides installability with
42
+ * that same function, and prerelease ordering is exactly what a hand-written
43
+ * comparison gets wrong.
44
+ *
45
+ * @param manifest - the installed bundle's parsed manifest, the source of the declared support line.
46
+ * @param runtimeVersion - the running DSH version, or `'unknown'` when it could not be read.
47
+ * @param bundleVersion - the installed bundle version, or `'unknown'`.
48
+ * @param unavailable - why the running version is not known, recorded when it is `'unknown'`.
49
+ * @returns the report the settings page renders.
50
+ */
51
+ export function evaluateEnvironment(manifest, runtimeVersion, bundleVersion, unavailable) {
52
+ const range = supportRangeOf(manifest);
53
+ const base = {
54
+ bundleVersion,
55
+ ...(range === undefined ? {} : { certifiedDshVersion: range.lower, supportRange: range }),
56
+ };
57
+ if (runtimeVersion === 'unknown') {
58
+ return Object.freeze({ ...base, verdict: 'undetermined', reason: unavailable ?? 'the running dsh version is unavailable' });
59
+ }
60
+ const running = { ...base, dshVersion: runtimeVersion };
61
+ // A real violation is answered first, and it is never downgraded to
62
+ // `undetermined`: a peer that drifted to a range of its own is a genuine
63
+ // "not satisfied" even though no single range can then be stated for the
64
+ // page. Only when nothing is violated does the question become whether the
65
+ // declared line can be stated at all.
66
+ // One evaluation covers every dsh peer in the manifest, and `range` above is
67
+ // derived from exactly those peers: re-judging the range it prints could not
68
+ // change this answer.
69
+ const satisfied = evaluatePluginCompatibility(manifest, {}, runtimeVersion) === undefined;
70
+ if (!satisfied)
71
+ return Object.freeze({ ...running, verdict: 'out-of-range' });
72
+ // Nothing is violated but there is no line to state: the page withholds the
73
+ // range rather than inventing one.
74
+ if (range === undefined) {
75
+ return Object.freeze({ ...base, verdict: 'undetermined', reason: 'the declared dsh support range is unreadable or drifted' });
76
+ }
77
+ return Object.freeze({ ...running, verdict: 'ok' });
78
+ }
79
+ /**
80
+ * Read this Host's own environment: the installed bundle version, the declared
81
+ * support line, and how the running DSH compares to it.
82
+ *
83
+ * The certified DSH version is the range's lower bound, never the newest cut
84
+ * tested against it: `docs/dsh-release-compatibility.md` §4 records a baseline
85
+ * inside the declared range without moving the peers, so every version spot
86
+ * keeps naming the bound. Reading it from anywhere else would reintroduce the
87
+ * hand-maintained constant this check exists to remove.
88
+ *
89
+ * @returns the report, with `verdict: 'undetermined'` for any fact not established.
90
+ */
91
+ export function reportEnvironment() {
92
+ const manifest = readInstalledManifest() ?? {};
93
+ const bundleVersion = bundleVersionOf(manifest);
94
+ let runtime;
95
+ try {
96
+ runtime = getDshRuntimeVersion();
97
+ }
98
+ catch (error) {
99
+ return evaluateEnvironment(manifest, 'unknown', bundleVersion, error instanceof Error ? error.message : String(error));
100
+ }
101
+ return evaluateEnvironment(manifest, runtime, bundleVersion);
102
+ }
@@ -1,33 +1,65 @@
1
1
  import z from '@deepseek-ai/schemastery';
2
+ import { parse } from 'yaml';
3
+ import { bundleVersionOf, readInstalledManifest } from "./installed-manifest.js";
2
4
  /**
3
5
  * Human identity profile: the one configurable display name plus the avatar
4
6
  * reference. `member:human` stays the durable identity everywhere; only the
5
7
  * handle shown in team_view, @ matching, and UI follows this profile.
6
8
  *
7
9
  * Storage split (see spec.md v1):
8
- * - name + avatarRef live in the Host settings namespace `agent-team-human`
9
- * (settings.yaml user layer, live through `ctx.settings`).
10
- * - avatar bytes live under a persistent directory below; the settings
11
- * document holds only the reference, never a data URL. The composer
12
- * attachment cache is TTL-bound and must not hold avatar bytes.
10
+ * - name + avatarRef are the Team Host row's own Config, so they live in the
11
+ * active profile's patch document as that row's `config` and the settings
12
+ * service derives their form from this schema. rc.1 derives every form from
13
+ * a plugin's Config, so the retired `installSection` namespace — a section of
14
+ * its own — has no counterpart; the row id below is the settings namespace.
15
+ * - avatar bytes live under a persistent directory below; the profile holds
16
+ * only the reference, never a data URL. The composer attachment cache is
17
+ * TTL-bound and must not hold avatar bytes.
18
+ *
19
+ * The legacy-section adoption below is transitional: it exists for installs
20
+ * upgraded from a pre-rc.1 profile document, and retires — with
21
+ * `LEGACY_HUMAN_PROFILE_SECTION`, `parseLegacyHumanProfile`, and
22
+ * `planLegacyAdoption` — once such installs are no longer supported. Nothing
23
+ * else in the Host reads that document.
24
+ */
25
+ /**
26
+ * Settings namespace of the Human profile: the Team Host row's id in
27
+ * `cordis.patch.yml`, which is what the settings service addresses a form and a
28
+ * write by AND the id the profile-document write patches. It is addressed by
29
+ * this constant, never by the running Host's `ctx.fiber.entry`: a Remote call
30
+ * runs under its caller's context, so that lookup names the RPC gateway's row.
31
+ * `shipping.spec.ts` pins the constant to the row the composition declares.
13
32
  */
14
- export const HUMAN_PROFILE_SETTINGS_NAMESPACE = 'agent-team-human';
33
+ export const HUMAN_PROFILE_SETTINGS_NAMESPACE = 'wowyuarm-agent-team-host';
15
34
  /** Fallback display name before any user override is stored. */
16
35
  export const HUMAN_PROFILE_DEFAULT_NAME = 'human';
17
36
  /** Repository home for the version footnote link. */
18
37
  export const HUMAN_PROFILE_REPO_URL = 'https://github.com/wowyuarm/dsh-agent-team';
19
38
  /**
20
- * Bundle version shown in the settings footnote. Kept in sync with the root
21
- * package.json by hand until the Host build injects it; the footnote is
22
- * informational only and never gates behavior.
39
+ * Bundle version shown in the settings footnote, and the current side of the
40
+ * update check: the version of the package THIS Host runs from — the installed
41
+ * manifest's, read once at load through `./installed-manifest.ts`, so a `link:`
42
+ * checkout under the development profile and a registry tarball under stable
43
+ * each state their own truth. It is not a hand-maintained string: the 0.1.14
44
+ * bundle shipped with `0.1.13` written in it, which made the footnote name the
45
+ * previous release and the update check offer the release the user already had.
46
+ *
47
+ * An unreadable or malformed manifest degrades to `'unknown'`: the Remote's
48
+ * `version: string` contract holds and the update comparison simply compares
49
+ * nothing. The footnote is informational only and never gates behavior.
50
+ */
51
+ export const HUMAN_PROFILE_VERSION = bundleVersionOf(readInstalledManifest());
52
+ /**
53
+ * Schemastery schema of the Human profile: the Team Host row's Config. Both
54
+ * fields are volatile, which is what lets an edit reach the running Host
55
+ * without remounting it — and what makes the settings service derive a form
56
+ * from this schema at all.
23
57
  */
24
- export const HUMAN_PROFILE_VERSION = '0.1.13';
25
- /** Schemastery schema resolving the `agent-team-human` namespace value. */
26
58
  export const HUMAN_PROFILE_SETTINGS_SCHEMA = z.object({
27
- name: z.string().default(HUMAN_PROFILE_DEFAULT_NAME),
59
+ name: z.string().default(HUMAN_PROFILE_DEFAULT_NAME).volatile(),
28
60
  // Schemastery fields are optional unless `.required()`: a missing avatarRef
29
61
  // simply resolves absent, which the profile reads as "no custom avatar".
30
- avatarRef: z.string(),
62
+ avatarRef: z.string().volatile(),
31
63
  });
32
64
  /** Normalize one candidate display name the way Member handles normalize. */
33
65
  export function normalizeHumanName(raw) {
@@ -44,3 +76,68 @@ export function assertValidHumanName(raw) {
44
76
  throw new Error('human name must not be empty');
45
77
  return name;
46
78
  }
79
+ /**
80
+ * The retired settings section this profile's facts lived in before rc.1.
81
+ * rc.1 derives every settings form from a plugin's Config, and its legacy
82
+ * `settings.yaml` importer maps a section to a composition entry id through a
83
+ * closed built-in list — this third-party section matches nothing there, so
84
+ * the import rejects it and the values survive only in the renamed document.
85
+ * This Host owns the section, so adopting what is left belongs here.
86
+ */
87
+ export const LEGACY_HUMAN_PROFILE_SECTION = 'agent-team-human';
88
+ /**
89
+ * Read the legacy section out of one legacy settings document. An
90
+ * unparsable document or a missing section means "nothing to adopt" rather
91
+ * than an error — the file is retired input, not an authority — and each
92
+ * field is validated independently so one bad field never costs the other.
93
+ */
94
+ export function parseLegacyHumanProfile(yamlText) {
95
+ let document;
96
+ try {
97
+ document = parse(yamlText);
98
+ }
99
+ catch {
100
+ return undefined;
101
+ }
102
+ if (typeof document !== 'object' || document === null)
103
+ return undefined;
104
+ const section = document[LEGACY_HUMAN_PROFILE_SECTION];
105
+ if (typeof section !== 'object' || section === null)
106
+ return undefined;
107
+ const fields = section;
108
+ let name;
109
+ if (typeof fields.name === 'string') {
110
+ try {
111
+ name = assertValidHumanName(fields.name);
112
+ }
113
+ catch {
114
+ name = undefined;
115
+ }
116
+ }
117
+ const avatarRef = typeof fields.avatarRef === 'string' && fields.avatarRef.trim() !== ''
118
+ ? fields.avatarRef.trim()
119
+ : undefined;
120
+ if (name === undefined && avatarRef === undefined)
121
+ return undefined;
122
+ return { ...(name === undefined ? {} : { name }), ...(avatarRef === undefined ? {} : { avatarRef }) };
123
+ }
124
+ /**
125
+ * Decide what adoption may write: nothing unless the stored profile is still
126
+ * the pristine default, so a value the Human re-entered after the upgrade
127
+ * always wins, and never the legacy default name itself. The current profile
128
+ * carries explicit `undefined` on `avatarRef` — the Host getter spreads the
129
+ * live Config read — and that shape does not satisfy the optional-property
130
+ * form under exactOptionalPropertyTypes; taking it directly keeps the Host
131
+ * call cast-free. The returned fields are exactly the ops the profile page
132
+ * would have written; byte existence for `avatarRef` is the caller's I/O and
133
+ * must already hold.
134
+ */
135
+ export function planLegacyAdoption(current, legacy) {
136
+ if (current.name !== HUMAN_PROFILE_DEFAULT_NAME || current.avatarRef !== undefined)
137
+ return undefined;
138
+ const name = legacy.name !== undefined && legacy.name !== HUMAN_PROFILE_DEFAULT_NAME ? legacy.name : undefined;
139
+ const avatarRef = legacy.avatarRef;
140
+ if (name === undefined && avatarRef === undefined)
141
+ return undefined;
142
+ return { ...(name === undefined ? {} : { name }), ...(avatarRef === undefined ? {} : { avatarRef }) };
143
+ }