@f5-sales-demo/xcsh 21.28.1 → 21.29.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 (41) hide show
  1. package/package.json +9 -8
  2. package/src/commands/manager.ts +5 -5
  3. package/src/extensibility/extensions/loader.ts +30 -0
  4. package/src/extensibility/extensions/types.ts +2 -0
  5. package/src/index.ts +3 -0
  6. package/src/internal-urls/build-info.generated.ts +8 -8
  7. package/src/internal-urls/xcsh-protocol.ts +45 -0
  8. package/src/main.ts +2 -0
  9. package/src/memories/index.ts +17 -5
  10. package/src/modes/controllers/command-controller.ts +1 -0
  11. package/src/person-profile/HISTORICAL-AUDIT.md +163 -0
  12. package/src/person-profile/README.md +88 -0
  13. package/src/person-profile/account-collectors.ts +209 -0
  14. package/src/person-profile/builder.ts +69 -0
  15. package/src/person-profile/collectors.ts +367 -0
  16. package/src/person-profile/machine-collectors.ts +400 -0
  17. package/src/person-profile/machine-profile.ts +128 -0
  18. package/src/person-profile/private-store.ts +134 -0
  19. package/src/person-profile/properties.ts +116 -0
  20. package/src/person-profile/salesforce-discovery.ts +162 -0
  21. package/src/person-profile/schema.ts +251 -0
  22. package/src/person-profile/service.ts +435 -0
  23. package/src/prompts/system/person-awareness.md +23 -0
  24. package/src/prompts/system/remote-voice-identity.md +13 -0
  25. package/src/prompts/system/remote-voice.md +2 -0
  26. package/src/prompts/tools/machine-profile.md +1 -0
  27. package/src/prompts/tools/person-profile.md +7 -0
  28. package/src/remote-control/ACCEPTANCE.md +48 -0
  29. package/src/remote-control/IMPLEMENTATION.md +67 -0
  30. package/src/remote-control/PARITY.md +44 -0
  31. package/src/remote-control/persona-evaluation.ts +45 -0
  32. package/src/remote-control/session.ts +4 -2
  33. package/src/remote-control/voice-persona.ts +104 -31
  34. package/src/remote-control/voice.ts +32 -17
  35. package/src/sdk.ts +40 -2
  36. package/src/services/xcsh-context.ts +9 -7
  37. package/src/session/agent-session.ts +1 -0
  38. package/src/system-prompt.ts +3 -0
  39. package/src/tools/index.ts +6 -0
  40. package/src/tools/machine-profile.ts +58 -0
  41. package/src/tools/person-profile.ts +143 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5-sales-demo/xcsh",
4
- "version": "21.28.1",
4
+ "version": "21.29.0",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/f5-sales-demo/xcsh",
7
7
  "author": "Can Boluk",
@@ -42,6 +42,7 @@
42
42
  "test": "bun run generate-build-info && bun scripts/bun-test-guarded.ts --max-concurrency=2",
43
43
  "bench:routing-matrix": "bun scripts/bench-routing-matrix.ts",
44
44
  "bench:copy-selector": "bun scripts/bench-copy-selector.ts",
45
+ "bench:voice-persona": "bun scripts/voice-persona-parity.ts",
45
46
  "fix": "biome check --write --unsafe . && bun run format-prompts && bun run generate-docs-index && bun run generate-api-spec-index && bun run generate-build-info",
46
47
  "fmt": "biome format --write . && bun run format-prompts",
47
48
  "format-prompts": "bun scripts/format-prompts.ts",
@@ -62,13 +63,13 @@
62
63
  },
63
64
  "dependencies": {
64
65
  "@agentclientprotocol/sdk": "1.4.0",
65
- "@f5-sales-demo/pi-agent-core": "21.28.1",
66
- "@f5-sales-demo/pi-ai": "21.28.1",
67
- "@f5-sales-demo/pi-natives": "21.28.1",
68
- "@f5-sales-demo/pi-resource-management": "21.28.1",
69
- "@f5-sales-demo/pi-tui": "21.28.1",
70
- "@f5-sales-demo/pi-utils": "21.28.1",
71
- "@f5-sales-demo/xcsh-stats": "21.28.1",
66
+ "@f5-sales-demo/pi-agent-core": "21.29.0",
67
+ "@f5-sales-demo/pi-ai": "21.29.0",
68
+ "@f5-sales-demo/pi-natives": "21.29.0",
69
+ "@f5-sales-demo/pi-resource-management": "21.29.0",
70
+ "@f5-sales-demo/pi-tui": "21.29.0",
71
+ "@f5-sales-demo/pi-utils": "21.29.0",
72
+ "@f5-sales-demo/xcsh-stats": "21.29.0",
72
73
  "@mozilla/readability": "^0.6",
73
74
  "@sinclair/typebox": "0.34.52",
74
75
  "@xterm/headless": "^6.0",
@@ -324,8 +324,8 @@ export default class Manager extends Command {
324
324
  XCSH_WORKER_SPARE: "1",
325
325
  XCSH_SESSION_ID: undefined,
326
326
  XCSH_SESSION_TENANT: undefined,
327
- XCSH_API_URL: undefined,
328
- XCSH_API_TOKEN: undefined,
327
+ XCSH_API_URL: "",
328
+ XCSH_API_TOKEN: "",
329
329
  },
330
330
  ipc(message) {
331
331
  if (!rec || !isWorkerReadyMessage(message)) return;
@@ -495,9 +495,9 @@ export default class Manager extends Command {
495
495
  // Isolate the worker's tenant binding: an ambient XCSH_API_URL in the
496
496
  // manager's env would make sdk.ts skip the XCSH_SESSION_TENANT branch and
497
497
  // bind hello_ack.tenant from the env apiUrl instead. Clear both so the
498
- // spawned tenant key is authoritative (undefined removes the var in Bun).
499
- XCSH_API_URL: undefined,
500
- XCSH_API_TOKEN: undefined,
498
+ // spawned tenant key is authoritative. Empty values also suppress saved .env defaults.
499
+ XCSH_API_URL: "",
500
+ XCSH_API_TOKEN: "",
501
501
  // TTFT Phase 2: relay cold-start timing to the worker (only it has a WS to
502
502
  // the extension). Wall-clock spawn instant + manager_provision ms; COLD=1
503
503
  // marks the authoritative cold spawn.
@@ -15,6 +15,7 @@ import { loadCapability } from "../../discovery";
15
15
  import { getExtensionNameFromPath, getPreloadedPluginRoots } from "../../discovery/helpers";
16
16
  import type { ExecOptions } from "../../exec/exec";
17
17
  import { execCommand } from "../../exec/exec";
18
+ import { type ProfileCollector, personProfileService } from "../../person-profile/service";
18
19
  import type { CustomMessage } from "../../session/messages";
19
20
  import { EventBus } from "../../utils/event-bus";
20
21
  import { getAllPluginExtensionPaths } from "../plugins/loader";
@@ -248,6 +249,35 @@ class ConcreteExtensionAPI implements ExtensionAPI, IExtensionRuntime {
248
249
  return this.runtime.setSessionName(name);
249
250
  }
250
251
 
252
+ registerProfileCollector(collector: ProfileCollector): void {
253
+ if (!collector || typeof collector.collect !== "function") throw new Error("Invalid person profile collector");
254
+ personProfileService.registerProfileCollector(
255
+ {
256
+ ...collector,
257
+ async collect(signal) {
258
+ const result = await collector.collect(signal);
259
+ if ("facts" in result) return result;
260
+ // Legacy flat output does not distinguish queried values from heuristic inference.
261
+ // Keep it as candidates; modern collectors can return explicit facts/observations.
262
+ return {
263
+ facts: {},
264
+ observations: Object.entries(result).map(([field, value]) => ({
265
+ field: field as keyof typeof result,
266
+ value,
267
+ source: collector.id,
268
+ kind: "inferred" as const,
269
+ observedAt: new Date().toISOString(),
270
+ })),
271
+ };
272
+ },
273
+ },
274
+ this.extension.resolvedPath,
275
+ );
276
+ }
277
+ unregisterProfileCollector(id: string): boolean {
278
+ return personProfileService.unregisterProfileCollector(id, this.extension.resolvedPath);
279
+ }
280
+
251
281
  registerProvider(name: string, config: import("./types").ProviderConfig): void {
252
282
  this.runtime.pendingProviderRegistrations.push({ name, config, sourceId: this.extension.path });
253
283
  }
@@ -1222,6 +1222,8 @@ export interface ExtensionAPI {
1222
1222
  * });
1223
1223
  */
1224
1224
  registerProvider(name: string, config: ProviderConfig): void;
1225
+ registerProfileCollector(collector: import("../../person-profile/service").ProfileCollector): void;
1226
+ unregisterProfileCollector(id: string): boolean;
1225
1227
 
1226
1228
  /** Shared event bus for extension communication. */
1227
1229
  events: EventBus;
package/src/index.ts CHANGED
@@ -38,6 +38,9 @@ export * from "./modes";
38
38
  export * from "./modes/components";
39
39
  // Theme utilities for custom tools
40
40
  export * from "./modes/theme/theme";
41
+ export type { PersonProfile, UserProfile, UserProfileObservation } from "./person-profile/schema";
42
+ export type { ProfileCollection, ProfileCollector } from "./person-profile/service";
43
+ export { loadProfile, PersonProfileService } from "./person-profile/service";
41
44
  export * from "./routing/classifier";
42
45
  export * from "./routing/coordinator";
43
46
  export * from "./routing/delegation";
@@ -17,17 +17,17 @@ export interface BuildInfo {
17
17
  }
18
18
 
19
19
  export const BUILD_INFO: BuildInfo = {
20
- "version": "21.28.1",
21
- "commit": "41c3dccba0e3969a761af369096d91f50cdf0143",
22
- "shortCommit": "41c3dcc",
20
+ "version": "21.29.0",
21
+ "commit": "80d13dac71233f0b9bd7946ea1a1b7cc6f764407",
22
+ "shortCommit": "80d13da",
23
23
  "branch": "main",
24
- "tag": "v21.28.1",
25
- "commitDate": "2026-09-13T17:35:05+00:00",
26
- "buildDate": "2026-09-13T18:16:37.787Z",
24
+ "tag": "v21.29.0",
25
+ "commitDate": "2026-09-13T22:01:04+00:00",
26
+ "buildDate": "2026-09-16T13:53:31.451Z",
27
27
  "dirty": true,
28
28
  "prNumber": "",
29
29
  "repoUrl": "https://github.com/f5-sales-demo/xcsh",
30
30
  "repoSlug": "f5-sales-demo/xcsh",
31
- "commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/41c3dccba0e3969a761af369096d91f50cdf0143",
32
- "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.28.1"
31
+ "commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/80d13dac71233f0b9bd7946ea1a1b7cc6f764407",
32
+ "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.29.0"
33
33
  };
@@ -25,6 +25,13 @@
25
25
  */
26
26
  import * as path from "node:path";
27
27
  import { logger } from "@f5-sales-demo/pi-utils";
28
+ import {
29
+ MachineProfileSchema,
30
+ type MachineProfileService,
31
+ machineProfileService,
32
+ } from "../person-profile/machine-profile";
33
+ import { PersonProfileSchema } from "../person-profile/schema";
34
+ import { type PersonProfileService, personProfileService } from "../person-profile/service";
28
35
  import type { ContainmentStatus } from "../sandbox/containment";
29
36
  import type { ContextStatus } from "../services/xcsh-context";
30
37
  import type { ActiveModelSnapshot } from "../session/active-model";
@@ -302,6 +309,8 @@ function loadConsoleFieldMetadata(): ConsoleFieldMetadataData {
302
309
  }
303
310
 
304
311
  export interface InternalDocsProtocolOptions {
312
+ personProfileService?: PersonProfileService;
313
+ machineProfileService?: MachineProfileService;
305
314
  readonly resolveBuildInfo?: () => Promise<RuntimeBuildInfo>;
306
315
  readonly getContextStatus?: () => ContextStatus | null;
307
316
  /**
@@ -343,7 +352,11 @@ export class InternalDocsProtocolHandler implements ProtocolHandler {
343
352
  readonly #registryDeps: Partial<RegistryResolverDeps> | undefined;
344
353
  readonly #getPluginRoots: GetPluginRoots | undefined;
345
354
 
355
+ readonly #personProfileService: PersonProfileService;
356
+ readonly #machineProfileService: MachineProfileService;
346
357
  constructor(options: InternalDocsProtocolOptions = {}) {
358
+ this.#personProfileService = options.personProfileService ?? personProfileService;
359
+ this.#machineProfileService = options.machineProfileService ?? machineProfileService;
347
360
  this.#resolveBuildInfo = options.resolveBuildInfo ?? getRuntimeBuildInfo;
348
361
  this.#getContextStatus = options.getContextStatus;
349
362
  this.#getActiveModel = options.getActiveModel;
@@ -433,6 +446,36 @@ export class InternalDocsProtocolHandler implements ProtocolHandler {
433
446
 
434
447
  async resolve(url: InternalUrl): Promise<InternalResource> {
435
448
  const host = url.rawHost || url.hostname;
449
+ if (host === "computer") {
450
+ const pathname = url.rawPathname ?? url.pathname;
451
+ if (new URL(url.href).search || !["", "/", "/schema"].includes(pathname))
452
+ throw new Error("Unsupported machine profile route; use machine_profile refresh");
453
+ const content = JSON.stringify(
454
+ pathname === "/schema" ? MachineProfileSchema : await this.#machineProfileService.get(),
455
+ );
456
+ return {
457
+ url: url.href,
458
+ content,
459
+ contentType: "application/json",
460
+ size: Buffer.byteLength(content),
461
+ sourcePath: "xcsh://computer",
462
+ };
463
+ }
464
+ if (host === "user") {
465
+ const pathname = url.rawPathname ?? url.pathname;
466
+ if (new URL(url.href).search || !["", "/", "/schema"].includes(pathname))
467
+ throw new Error("Unsupported person profile route; use person_profile refresh explicitly");
468
+ const content = JSON.stringify(
469
+ pathname === "/schema" ? PersonProfileSchema : await this.#personProfileService.get(),
470
+ );
471
+ return {
472
+ url: url.href,
473
+ content,
474
+ contentType: "application/json",
475
+ size: Buffer.byteLength(content),
476
+ sourcePath: "xcsh://user",
477
+ };
478
+ }
436
479
 
437
480
  if (host === API_SPEC_HOST) {
438
481
  return this.#getApiSpecResolver().resolve(url);
@@ -523,6 +566,8 @@ export class InternalDocsProtocolHandler implements ProtocolHandler {
523
566
  const terraformEntry = `- [${TERRAFORM_HOST}/](${SCHEME_PREFIX}${TERRAFORM_HOST}/) — F5 XC Terraform provider (${Object.keys(tf.resources).length} resources, v${tf.version})`;
524
567
  const registryEntry = `- [${REGISTRY_HOST}/provider/<namespace>/<type>](${SCHEME_PREFIX}${REGISTRY_HOST}/provider/hashicorp/random) — live Terraform provider and module Registry metadata`;
525
568
  const entries = [
569
+ "- [user](xcsh://user) — local person profile; [schema](xcsh://user/schema)",
570
+ "- [computer](xcsh://computer) — interaction machine profile; [schema](xcsh://computer/schema)",
526
571
  syntheticEntry,
527
572
  changesEntry,
528
573
  sourceEntry,
package/src/main.ts CHANGED
@@ -1025,6 +1025,8 @@ export async function runRootCommand(rawArgs: string[]): Promise<void> {
1025
1025
 
1026
1026
  // YAGNI: skip MCP server discovery (500-3000ms) — not used in our workflow.
1027
1027
  sessionOptions.enableMCP = false;
1028
+ // Trusted process configuration can disable automatic discovery (for isolated CLI tests or embedding).
1029
+ sessionOptions.profileDiscovery = process.env.XCSH_PROFILE_DISCOVERY !== "0";
1028
1030
 
1029
1031
  const { session, setToolUIContext, modelFallbackMessage, lspServers, mcpManager, eventBus } = await logger.time(
1030
1032
  "createAgentSession",
@@ -149,10 +149,25 @@ export function startMemoryStartupTask(options: {
149
149
  export async function buildMemoryToolDeveloperInstructions(
150
150
  agentDir: string,
151
151
  settings: Settings,
152
+ projectCwd = settings.getCwd(),
153
+ ): Promise<string | undefined> {
154
+ const summary = await readMemorySummary(agentDir, settings, projectCwd);
155
+ if (!summary) return undefined;
156
+
157
+ return prompt.render(readPathTemplate, {
158
+ memory_summary: summary,
159
+ });
160
+ }
161
+
162
+ /** Read the same bounded project-memory summary used by the terminal prompt. */
163
+ export async function readMemorySummary(
164
+ agentDir: string,
165
+ settings: Settings,
166
+ projectCwd = settings.getCwd(),
152
167
  ): Promise<string | undefined> {
153
168
  const cfg = loadMemoryConfig(settings);
154
169
  if (!cfg.enabled) return undefined;
155
- const memoryRoot = getMemoryRoot(agentDir, settings.getCwd());
170
+ const memoryRoot = getMemoryRoot(agentDir, projectCwd);
156
171
  const summaryPath = path.join(memoryRoot, "memory_summary.md");
157
172
 
158
173
  let text: string;
@@ -166,10 +181,7 @@ export async function buildMemoryToolDeveloperInstructions(
166
181
  if (!summary) return undefined;
167
182
  const truncated = truncateByApproxTokens(summary, cfg.summaryInjectionTokenLimit);
168
183
  if (!truncated.trim()) return undefined;
169
-
170
- return prompt.render(readPathTemplate, {
171
- memory_summary: truncated,
172
- });
184
+ return truncated;
173
185
  }
174
186
 
175
187
  /**
@@ -1587,6 +1587,7 @@ export class CommandController {
1587
1587
  `Session files moved; project refresh failed: ${error instanceof Error ? error.message : String(error)}`,
1588
1588
  );
1589
1589
  }
1590
+ await this.ctx.session.refreshBaseSystemPrompt();
1590
1591
  if (target.getCwd() !== destination) throw new Error("Session directory changed during the move.");
1591
1592
  this.#pendingMoves.delete(identity);
1592
1593
  },
@@ -0,0 +1,163 @@
1
+ # Person awareness restoration audit for #3818
2
+
3
+ This audit compares repair `54d586d78` with xcsh
4
+ `b0fae945221c094cfda26f884970aa146e8f5370`, the parent of removal
5
+ `3f3a561b2`. Marketplace reference
6
+ `73064eb153fa50e48933f3060abe7e6622ad8e41` is the last marketplace commit
7
+ before that xcsh reference's timestamp. Source inspection used those pinned
8
+ revisions, not account data or conversation transcripts.
9
+
10
+ The restoration is incomplete. A canonical store and successful get operation do
11
+ not establish discovery parity. The historical implementation combined a saved
12
+ person profile, a separate saved computer profile, plugin account hints, Salesforce
13
+ business discovery, and automatic startup language discovery. These have different
14
+ lifecycles and must be assessed separately.
15
+
16
+ ## Core person discovery and persistence
17
+
18
+ Historical source: [user-profile.ts](https://github.com/f5-sales-demo/xcsh/blob/b0fae945221c094cfda26f884970aa146e8f5370/packages/coding-agent/src/internal-urls/user-profile.ts)
19
+ and [profile-collectors.ts](https://github.com/f5-sales-demo/xcsh/blob/b0fae945221c094cfda26f884970aa146e8f5370/packages/coding-agent/src/internal-urls/profile-collectors.ts).
20
+
21
+ | Function or contract | Historical purpose and actual behavior | Repair assessment |
22
+ | --- | --- | --- |
23
+ | `UserProfile` | Identity, contact, employment, address, demographics, family, online identities, business role, partner, territories, quota, observations, source timestamps, field ownership. | Most fact families restored in a validated envelope. |
24
+ | `UserProfileObservation` | Free-form key/value, optional source and observation timestamp. | Narrowed to known person fields and mandatory inferred status. No model-facing observation operation exists. |
25
+ | `loadProfile` | Read one OS user's JSON; return empty on missing or malformed input. | Secure service read replaces it, but the legacy exported reader is absent. Malformed data now fails intact. |
26
+ | `saveProfile` | Stamp `updatedAt` and write the whole JSON document. | Atomic, revision-checked mutation replaces unrestricted whole-file writes. Legacy writer is absent intentionally; compatibility must not bypass ownership or approval. |
27
+ | `mergeProfile` | Fill missing scalars; union `sameAs`; populate absent languages. Object fields actually use whole-object first-wins despite a subfield-merge comment. | Replaced by ownership reconciliation. Multiple source identifiers still compete for one top-level `identifiers` field. |
28
+ | `seedProfile` | Run available collectors in order, merge, record source timestamps and per-source results, save. | Explicit `refresh` exists, but fresh sessions do not initiate it. |
29
+ | `reconcileProfile` | Refresh same-owner fields; preserve user and other-source ownership. `authoritativeFields` can replace existing **unowned** values. | Ownership restored; `authoritativeFields` is accepted and validated but unused. New profiles disallow unowned facts, so the old adoption case needs explicit migration semantics. |
30
+ | `reconcileFromCollectors` | Run **all available registered collectors**, reconcile their output, record source timestamps, save. | Runs only previously configured sources. Missing profiles have none. This changes first-run behavior. |
31
+ | `renderSeedReport` | Format collector status, contributed field names and errors. | Structured sanitized statuses replace it; durable per-source attempt/freshness status is absent. |
32
+ | `renderProfileMarkdown` | Render saved facts, observations and source freshness; provide an empty-profile seed hint. | JSON resource/tool replaces rendering. Empty state is explicit. |
33
+ | `formatAddress`, `hasValues`, `titleCase` | Presentation helpers for the preceding reports. | No independent discovery or persistence responsibility. |
34
+ | `runCli` | Execute a CLI with a killable timeout. | Restored with cancellation, bounded output and suppressed stderr. |
35
+ | `splitFullName` | First whitespace token becomes given name; remainder becomes family name. | Restored heuristic; not proof of a person's legal name structure. |
36
+ | Salesforce `available`, `collect`, `parseSalesforceUserRecord` | Detect authenticated CLI, resolve current username, query User record, map contact/employment/manager/address/ID. | Restored basic adapter. Invented employer fallback removed. Does not restore the richer plugin discovery below. |
37
+ | GitHub `available`, `collect`, `parseGithubUserJson` | Check authentication, call `gh api user`, map name, public email, bio, site, GitHub/Twitter IDs and links. | Restored. Did not enumerate private email addresses or all authenticated accounts. |
38
+ | Git `available`, `collect` | Read effective `user.name` and `user.email`, including project configuration. | Uses global configuration now to preserve the cross-project person boundary. |
39
+ | `detectDarwinLanguages`, `detectLinuxLanguages` | Read OS language preferences or locale environment. | Collector helpers restored. UI application path is missing. |
40
+ | `detectSystemFullName` and system `available`/`collect` | Read local account full name plus language candidates. Linux incorrectly selected the shell column as GECOS. | UID-based GECOS column-five fix restored. Machine hardware belongs to a different collector. |
41
+ | `PROFILE_COLLECTORS`, registry facade | Ordered Salesforce, GitHub, Git, system, then extensions. Facade avoided historical bundler recursion problems. | Service owns a map instead of a mutable shared array. |
42
+ | `registerProfileCollector`, `unregisterProfileCollector` | Append unique collector; remove by ID. Duplicate core IDs were silently skipped by extension registration. | Registration restored with stronger validation; unregister absent. Built-in Salesforce collision now throws and can abort plugin loading. |
43
+
44
+ ## Startup, learning and retrieval
45
+
46
+ | Entry point | Historical behavior | Repair assessment |
47
+ | --- | --- | --- |
48
+ | `cli.ts` → `discoverAndApplyLanguage` | After settings initialization, skip when `XCSH_LOCALE` is set. Read person languages; otherwise collect system data, merge and **save the profile**, then map the first language to a supported UI locale. | This automatic discovery/save/application path was not restored. |
49
+ | `InteractiveMode.init` | Start person reconciliation and computer seeding in the background on TUI startup. | Common SDK registration is an improvement for interface parity, but configured-only reconciliation means a new store remains empty. |
50
+ | SDK system-prompt rebuild | Read saved profile, derive name, role/job title and employer; read computer profile and derive hardware hint. | Person values deliberately retrieved on demand instead. Initialization must still complete independently of the first person question. |
51
+ | Managed `Primary Human` prompt | Include compact saved identity; require `xcsh://user` for identity, communications and PII questions. | Mandatory capability guidance is restored, including custom prompt paths. |
52
+ | `xcsh://user` handler | Plain read loads saved data. `?seed=true` collects and writes, then returns profile/report. | Plain read and schema restored. Mutating read deliberately replaced by an approved explicit tool operation. |
53
+ | `xcsh://computer` handler | Plain read loads machine cache; `?refresh=true` collects and saves. | Excluded by the original repair plan; no accidental restoration should be claimed. |
54
+ | Conversational recording | The profile supported observations, but historical core call sites had no general conversation writer. | Explicit user facts use `update`; inferred observations have a distinct service and tool path. |
55
+
56
+ Historical entry points:
57
+ [language discovery](https://github.com/f5-sales-demo/xcsh/blob/b0fae945221c094cfda26f884970aa146e8f5370/packages/coding-agent/src/discovery/language.ts),
58
+ [interactive startup](https://github.com/f5-sales-demo/xcsh/blob/b0fae945221c094cfda26f884970aa146e8f5370/packages/coding-agent/src/modes/interactive-mode.ts),
59
+ [SDK](https://github.com/f5-sales-demo/xcsh/blob/b0fae945221c094cfda26f884970aa146e8f5370/packages/coding-agent/src/sdk.ts).
60
+
61
+ ## Account plugins and Salesforce business discovery
62
+
63
+ | Plugin function or hook | Purpose and persistence boundary |
64
+ | --- | --- |
65
+ | AWS `before_agent_start` | Execute STS caller identity; inject account ID, ARN, active profile and region as hidden `aws_hint` session content. Does **not** call the person writer or register a person collector. |
66
+ | Azure `before_agent_start` | Execute `az account show`; inject subscription, tenant, user name/type and cloud as hidden `azure_hint` session content. Does **not** persist these in the person file. |
67
+ | AWS/Azure service-status `check` | Report CLI/authentication readiness. Fix commands launch supported login flows; they are not person discovery. |
68
+ | AWS/Azure account tools | On-demand account identity retrieval. An assumed role or service principal is not necessarily the human user. |
69
+ | GitHub `before_agent_start` | Inject repository, branch and URL. Separate from core `gh api user` person collection. |
70
+ | Plugin `session_start` hooks | Missing-CLI/authentication diagnostics. AWS/Azure identity injection happens before agent turns, not through person background reconciliation. |
71
+ | Salesforce `setLoadProfile`, `getLoadProfile`, `loadProfileSafe` | Inject/access the canonical legacy facts reader. Plugin fallback directly reads the old flat person JSON. The new envelope breaks that fallback. |
72
+ | Salesforce registered collector `available`, `collect` | Use cached context or Salesforce person ID; seed missing/stale context; map person-related results back into reconciliation. Requires a working reader and registration. |
73
+ | `loadSalesforceContext`, `saveSalesforceContext`, `salesforceContextIsStale` | Maintain a separate timestamped business-context cache, not the person document. |
74
+ | `runSfQuery`, `getOrgInfo`, `describeSObject` | Execute queries, resolve active org, discover schema and supported field metadata. |
75
+ | `territorySoqlPath`, `rankTerritoryFieldCandidates` | Identify queryable territory fields and relationship paths from actual org metadata. |
76
+ | `readPath`, `probeTerritoryField`, `pickBestTerritoryField` | Read nested query results, count candidate coverage, select by coverage then finer partition then lexical order. |
77
+ | `discoverTerritories` | Discover assigned pipeline territory values, compare team/total coverage, retain selected field and details. |
78
+ | `discoverAccounts` | Aggregate active customer accounts from the user's opportunity-team membership. These are business accounts, not login accounts. |
79
+ | `discoverSegmentations`, `discoverForecasts`, `discoverStages` | Discover actual product, forecast and stage vocabulary; do not assume every org uses defaults. |
80
+ | `discoverPipelineSummary`, `discoverTeamRoles` | Aggregate open pipeline totals and team roles for business context. |
81
+ | `inferRoleFromTitle` | Heuristic role abbreviation; it is inference, even though the old mapper promoted the result into a fact. |
82
+ | `discoverPartner` | Choose the most frequent co-participant in open opportunities; infer their role from title. Co-occurrence is not confirmed personal partnership. |
83
+ | `discoverRoleAndTeam` | Query manager, user role and active team; infer role abbreviation. |
84
+ | `discoverSalesforceContext` | Resolve org/schema/person Salesforce ID, run business probes concurrently, merge context. |
85
+ | `seedSalesforceContext` | Discover and save context. |
86
+ | `splitName`, `mapPartner`, `mapSalesforceToProfile` | Map manager, partner, territories and inferred role from business context into person fields. |
87
+ | `joinWithBudget`, `buildSalesforceHint`, `renderSalesforceContextMarkdown` | Bound prompt summaries and render richer business context. No independent person writes. |
88
+
89
+ Pinned plugin sources:
90
+ [AWS](https://github.com/f5-sales-demo/marketplace/blob/73064eb153fa50e48933f3060abe7e6622ad8e41/plugins/aws/src/index.ts),
91
+ [Azure](https://github.com/f5-sales-demo/marketplace/blob/73064eb153fa50e48933f3060abe7e6622ad8e41/plugins/azure/src/index.ts),
92
+ [GitHub](https://github.com/f5-sales-demo/marketplace/blob/73064eb153fa50e48933f3060abe7e6622ad8e41/plugins/github/src/index.ts),
93
+ [Salesforce registration](https://github.com/f5-sales-demo/marketplace/blob/73064eb153fa50e48933f3060abe7e6622ad8e41/plugins/salesforce/src/index.ts),
94
+ [business discovery](https://github.com/f5-sales-demo/marketplace/blob/73064eb153fa50e48933f3060abe7e6622ad8e41/plugins/salesforce/src/context/salesforce-context.ts),
95
+ [person mapper](https://github.com/f5-sales-demo/marketplace/blob/73064eb153fa50e48933f3060abe7e6622ad8e41/plugins/salesforce/src/context/profile-mapper.ts).
96
+
97
+ The preserved runtime launches with external extensions disabled. Its missing
98
+ AWS/Azure hints are therefore expected under that launcher configuration, independently
99
+ of whether the person service is registered. Their historical presence does not prove
100
+ that AWS/Azure were canonical person collectors. Integrating them into the canonical
101
+ contract would be new work, and should retain account-principal observations separately
102
+ from confirmed human facts.
103
+
104
+ ## Separate computer profile
105
+
106
+ Historical [computer-profile.ts](https://github.com/f5-sales-demo/xcsh/blob/b0fae945221c094cfda26f884970aa146e8f5370/packages/coding-agent/src/internal-urls/computer-profile.ts)
107
+ used its own `computer-profile.json` and Schema.org `IndividualProduct` vocabulary.
108
+
109
+ | Function | Purpose |
110
+ | --- | --- |
111
+ | `getTerminalName` | Interpret terminal environment metadata. |
112
+ | `loadComputerProfile`, `saveComputerProfile` | Read/write the separate cache and stamp `collectedAt`. |
113
+ | `collectInstant` | Collect OS, kernel, architecture, CPU, memory, hostname, shell and terminal without subprocesses. |
114
+ | `collectDarwin`, `collectLinux`, `collectWindows` | Platform-specific model, physical cores and OS-version probes. |
115
+ | `collectDiskInfo` | Root filesystem capacity/free space on supported Unix platforms. |
116
+ | `collectInstalledTools` | CLI presence, including `az`, `aws`, `gh` and `sf`; no account enumeration. |
117
+ | `detectMdmVendor`, `collectManagement` | Management enrollment/vendor, organization and supervision metadata where available. Presence of a management binary was sometimes treated as managed status. |
118
+ | `collectSecurity` | Group-based admin heuristic plus macOS SIP, encryption, Gatekeeper and firewall status. These heuristics are not reliable authorization checks. |
119
+ | `collectEndpointAgents` | Activated macOS extensions or known endpoint-agent binary presence elsewhere. |
120
+ | `collectDeferred` | Run platform, disk, management, security, endpoint and tool probes concurrently. |
121
+ | `seedComputerProfile` | Merge existing cache with instant/deferred results and save. |
122
+ | `computerProfileIsStale` | Compare age with a 24-hour threshold. No production caller was found at the pinned revision; startup seeding was unconditional. |
123
+ | `buildComputerHint` | Compact runtime environment summary for prompts. |
124
+ | `renderComputerProfileMarkdown` | Full cached machine report for the internal resource. |
125
+
126
+ ## Updated scope and qualification
127
+
128
+ The user subsequently confirmed that automatic person discovery **and** the separate
129
+ machine profile belong in this repair. The PII builder is a central self-awareness
130
+ requirement, not a fixed collection of account lookups. The source comparison above
131
+ describes the deficiencies of `54d586d78`; the follow-up implementation restores a
132
+ shared periodic builder, machine storage and retrieval, language initialization,
133
+ broader account evidence, Salesforce relationship discovery, extension compatibility,
134
+ and a model-facing structured observe operation. Collection is extensible, and
135
+ account or inferred relationship evidence remains distinct from confirmed human facts.
136
+
137
+ New regressions cover fresh-store initialization, source opt-out, account changes,
138
+ email suppression across account evidence, ordinary prompt preparation and resumed
139
+ Plan mode before TUI initialization finishes. Executing-agent qualification now adds
140
+ automatic population and machine retrieval to the existing empty-profile, learning,
141
+ correction and forgetting scenarios. Physical phone acceptance remains a separate gate.
142
+
143
+ 1. Verify the now-authorized automatic person and machine discovery behavior. Keep
144
+ plain resource reads side-effect free and block collection commits in Plan mode.
145
+ 2. Test startup discovery from a missing store with synthetic available/unavailable
146
+ accounts, restart freshness, source failures and four-session races. A seeded store
147
+ bypasses the missing initialization path.
148
+ 3. Exercise actual extension registration and profile-reader compatibility. Do not
149
+ simply permit duplicate IDs to replace another source or restore unrestricted writes.
150
+ 4. Preserve multiple account identifiers without allowing a source change to select a
151
+ different local person. Label service principals, role sessions, locale-derived language
152
+ and inferred business relationships according to the evidence actually available.
153
+ 5. Test background cancellation, mode changes, source opt-out, corrections and forgetting.
154
+ A refresh toggle must support disabling previously configured sources.
155
+ 6. Reject person answers that append project-memory or prior-test recaps, even after a
156
+ successful canonical get. The first native baseline is superseded by this stricter
157
+ acceptance condition. The follow-up synthetic harness covers an empty profile,
158
+ prior session history and an available memory read tool.
159
+
160
+ This source audit is not a live acceptance receipt. It does not claim that cloud
161
+ accounts were queried or that physical iPhone acceptance passed. Preserve existing
162
+ runtime sessions through qualification and verify the newly built artifact before
163
+ continuing physical acceptance.
@@ -0,0 +1,88 @@
1
+ # Local person profile
2
+
3
+ `PersonProfileService` owns one OS user's `~/.xcsh/user-profile.json`, shared across
4
+ projects, models, provider accounts and paired transports. Agent-session construction
5
+ attaches the same service to the built-in `person_profile` tool and read-only
6
+ `xcsh://user` resource. `xcsh://user/schema` exposes the runtime schema. Trusted
7
+ embedders can inject an isolated service for testing; model arguments cannot select
8
+ a store or another user.
9
+
10
+ `schema.ts` defines the runtime validation, inferred TypeScript types and tool field
11
+ schema. Facts use [Schema.org Person](https://schema.org/Person) vocabulary where
12
+ applicable. Department, division, manager, source identifiers, sales role, partner,
13
+ territories and quota are xcsh-specific business fields. This is a bounded local
14
+ representation, not a complete JSON-LD implementation.
15
+
16
+ Reads never seed or write. Missing storage returns `state: empty` at revision zero.
17
+ Malformed, unsupported, oversized or insecure profile files return sanitized errors
18
+ and remain intact. Writes create owner-only storage, tighten the containing directory
19
+ to mode `0700`, serialize processes with an exclusive lock directory, check revisions,
20
+ sync a new `0600` file, and atomically rename it. An abandoned lock fails closed;
21
+ remove that exact lock only after verifying its owning operation has ended.
22
+
23
+ The tool provides get, sources, update, observe, refresh and forget. Mutations require the revision
24
+ from a current get. Ask uses the session's existing UI interaction owner; Plan denies
25
+ profile mutations. Abort signals propagate through approval, collection and commit.
26
+ Only explicit user statements and corrections belong in update. Prompts instruct
27
+ agents to exclude repository documents, retrieved content and inference from user
28
+ assertions, and to store normalized facts without quotations. This semantic distinction
29
+ requires agent judgment; a tool argument alone cannot prove who asserted a fact.
30
+
31
+ Every established field has source, owner and observation time. User corrections
32
+ own their fields; collectors can refresh only unowned fields or fields they already
33
+ own. Ownership is at the top-level field boundary, including compound fields such
34
+ as address. The xcsh additionalProperty extension uses Schema.org PropertyValue-shaped
35
+ entries for attributes without a standard Person field. Each stable propertyID has its
36
+ own ownership, provenance and value-free forgetting suppression; updating one entry
37
+ preserves the others. Tool forget accepts propertyIds for selective removal. Observed account evidence and inferred observations never establish facts. Forget
38
+ removes values, provenance and observations for the selected field, leaving only a
39
+ suppression timestamp. Forgetting email also removes email-bearing account evidence;
40
+ future evidence passes through the same suppression filter. An explicit user update
41
+ can reestablish that field. A changed collector identity produces observations instead
42
+ of silently replacing the human's established identity.
43
+
44
+ CLI sessions automatically start the PII builder, including launches with extensions
45
+ disabled. Trusted process configuration `XCSH_PROFILE_DISCOVERY=0` disables automatic
46
+ discovery for isolated CLI tests or embedding; tool reads and explicit refresh remain
47
+ available. SDK embedders enable the same lifecycle with `profileDiscovery: true` and
48
+ can inject isolated person and machine services. Background discovery checks once a
49
+ minute, with five-minute person-source freshness and daily machine freshness. The
50
+ first normal input and queued input join pending preparation. Disposal cancels the
51
+ builder, and both restored and newly entered Plan mode prevent commits.
52
+
53
+ Salesforce, GitHub, associated GitHub email addresses, global Git, system, Azure,
54
+ AWS, Google Cloud and GitLab adapters provide initial sources. Extensions add validated
55
+ collectors; source discovery is programmatic and does not hardcode these names into
56
+ the tool schema. Observe also records structured evidence learned during interaction
57
+ from other identified sources, preserving observed versus inferred status. Neither
58
+ credentials nor source quotations belong in the profile. Directory and account
59
+ principals remain evidence until associated with the human; service accounts and role
60
+ sessions never establish human identity by themselves.
61
+
62
+ Collector output is validated and bounded; raw output and errors are not logged.
63
+ The Linux adapter reads GECOS column five by UID. OS locale supplies UI preference
64
+ and an inferred language observation. Per-source attempt/success timestamps and
65
+ sanitized status persist even when a source is unavailable. Refresh selects named
66
+ collectors or all registered collectors when sources are omitted. Configure selects
67
+ future background sources; an empty configured list disables person collection.
68
+
69
+ `MachineProfileService` maintains a separate private `computer-profile.json`, using
70
+ Schema.org IndividualProduct identity with explicitly described xcsh environment
71
+ fields. Historical hardware, OS, CPU, memory, disk, terminal, tool, management and
72
+ security probes are restored with bounded subprocesses. These are environment
73
+ observations, not authorization decisions. `interactionDevices` links the human to
74
+ the device used for interaction without claiming ownership. `machine_profile` and
75
+ read-only `xcsh://computer` share this service; `xcsh://computer/schema` exposes its
76
+ runtime schema. Person and machine files share secure persistence mechanics.
77
+
78
+ The read-only `loadProfile` compatibility export returns flat facts to legacy
79
+ marketplace collectors. Built-in IDs are retained when a richer plugin registers
80
+ the same ID; the plugin receives an `_extension` collector ID, with its own ownership.
81
+ Another extension cannot take over that registration. Unregister is scoped to the
82
+ registrant. Reconciliation saves bootstrap results before dependent collectors run.
83
+
84
+ Voice delegates to the attached agent and retrieves person values on demand. It does
85
+ not label project memory as person data or preload a person profile. The executing-agent
86
+ parity harness uses isolated synthetic people and validates canonical tool results;
87
+ it does not replace physical iPhone acceptance. Diagnostic receipts contain outcomes
88
+ and counts, never profile values, prompts, transcripts, audio or credentials.