@dayofweek/dcli 1.8.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/dcli.js CHANGED
@@ -267,10 +267,31 @@ brainSource
267
267
  .option("--mime <mimeType>", "MIME type; inferred from extension when omitted")
268
268
  .option("--meeting", "Mark this source as a recorded meeting")
269
269
  .option("--consent-ack", "Confirm recorded participants were informed and consented")
270
+ .option("--as-source", "Store an HTML document as a raw source instead of publishing it as a Page")
270
271
  .action(async (opts) => {
271
272
  if (opts.meeting && !opts.consentAck) {
272
273
  throw new Error("--consent-ack is required: you are attesting that recorded participants were informed and consented");
273
274
  }
275
+ // A full HTML document is almost always meant to be a Page (the Pages tab),
276
+ // which is published as a note via `brain share` — not stored as a raw
277
+ // source. Uploading it here would land it in Sources, where nobody looks
278
+ // for a page. Refuse unless the caller explicitly wants a raw source.
279
+ if (!opts.asSource) {
280
+ const looksHtmlName = /\.html?$/i.test(opts.file);
281
+ let looksHtmlContent = false;
282
+ try {
283
+ const head = readFileSync(opts.file, "utf8").slice(0, 512);
284
+ looksHtmlContent = /^\s*(<!doctype html|<html[\s>])/i.test(head);
285
+ }
286
+ catch {
287
+ // Unreadable as text (binary) — not an HTML page.
288
+ }
289
+ if (looksHtmlName || looksHtmlContent) {
290
+ throw new Error("This looks like a Page (a full HTML document). Pages live in the area's Pages tab and are published with:\n" +
291
+ " dcli brain share --area <areaId> --title \"…\" --file " + opts.file + "\n" +
292
+ "Pass --as-source only if you really want the raw HTML stored as a source file.");
293
+ }
294
+ }
274
295
  output(await getClient().uploadBrainSource({
275
296
  areaId: opts.area,
276
297
  path: opts.file,
@@ -328,6 +349,87 @@ brainActors
328
349
  description: opts.description,
329
350
  }));
330
351
  });
352
+ brainActors
353
+ .command("matrix")
354
+ .description("The interview matrix: guide questions × active actors")
355
+ .requiredOption("--area <areaId>", "Area id (from `brain list`)")
356
+ .action(async (opts) => {
357
+ output(await getClient().getBrainActorMatrix(opts.area));
358
+ });
359
+ brainActors
360
+ .command("extract")
361
+ .description("Trigger the platform's answer extraction (all active actors, or one)")
362
+ .requiredOption("--area <areaId>", "Area id (from `brain list`)")
363
+ .option("--actor <actorId>", "Only this actor")
364
+ .action(async (opts) => {
365
+ output(await getClient().extractBrainActorAnswers({ areaId: opts.area, actorId: opts.actor }));
366
+ });
367
+ brainActors
368
+ .command("answer")
369
+ .description("Write one interview-matrix cell directly (marked capturedVia dcli, authoritative)")
370
+ .requiredOption("--actor <actorId>", "Actor id (from `brain actors list`)")
371
+ .requiredOption("--question <questionId>", "Question id (from `brain actors matrix`)")
372
+ .requiredOption("--answer <text>", "The answer; cite the source material in the text")
373
+ .option("--status <status>", "answered | partial | unknown", "answered")
374
+ .action(async (opts) => {
375
+ if (!["answered", "partial", "unknown"].includes(opts.status)) {
376
+ throw new Error(`--status must be answered, partial or unknown, got "${opts.status}"`);
377
+ }
378
+ output(await getClient().setBrainActorAnswer({
379
+ actorId: opts.actor,
380
+ questionId: opts.question,
381
+ answer: opts.answer,
382
+ status: opts.status,
383
+ }));
384
+ });
385
+ brainActors
386
+ .command("scores")
387
+ .description("Readiness scores: dimensions × active actors with full cells")
388
+ .requiredOption("--area <areaId>", "Area id (from `brain list`)")
389
+ .action(async (opts) => {
390
+ output(await getClient().getBrainActorScores(opts.area));
391
+ });
392
+ brainActors
393
+ .command("score")
394
+ .description("Trigger the platform's readiness scoring (all active actors, or one)")
395
+ .requiredOption("--area <areaId>", "Area id (from `brain list`)")
396
+ .option("--actor <actorId>", "Only this actor")
397
+ .action(async (opts) => {
398
+ output(await getClient().scoreBrainActors({ areaId: opts.area, actorId: opts.actor }));
399
+ });
400
+ brainActors
401
+ .command("set-score")
402
+ .description("Write one readiness band directly (marked capturedVia dcli, authoritative)")
403
+ .requiredOption("--actor <actorId>", "Actor id (from `brain actors list`)")
404
+ .requiredOption("--dimension <key>", "Dimension key (from `brain actors scores`)")
405
+ .requiredOption("--band <band>", "red | orange | green")
406
+ .requiredOption("--rationale <text>", "Grounds for the band — required")
407
+ .option("--score <number>", "0..1 numeric backing (default derived from band)", parseFloat)
408
+ .option("--gaps <items...>", "Identified gaps")
409
+ .action(async (opts) => {
410
+ if (!["red", "orange", "green"].includes(opts.band)) {
411
+ throw new Error(`--band must be red, orange or green, got "${opts.band}"`);
412
+ }
413
+ output(await getClient().setBrainActorScore({
414
+ actorId: opts.actor,
415
+ dimensionKey: opts.dimension,
416
+ band: opts.band,
417
+ score: opts.score,
418
+ rationale: opts.rationale,
419
+ gaps: opts.gaps,
420
+ }));
421
+ });
422
+ brainSource
423
+ .command("scope <sourceId>")
424
+ .description("Scope a source to an actor (feeds the readiness tables)")
425
+ .option("--actor <actorId>", "Actor id (from `brain actors list`)")
426
+ .option("--clear", "Return the source to area level")
427
+ .action(async (sourceId, opts) => {
428
+ if (Boolean(opts.actor) === Boolean(opts.clear)) {
429
+ throw new Error("Pass exactly one of --actor <actorId> or --clear");
430
+ }
431
+ output(await getClient().scopeBrainSource(sourceId, opts.actor ?? null));
432
+ });
331
433
  auth
332
434
  .command("devices")
333
435
  .description("List your agent tokens")
@@ -4484,6 +4484,40 @@ var DayOfWeekClient = class {
4484
4484
  async createBrainActor(input) {
4485
4485
  return this.post("/brain/actors", input);
4486
4486
  }
4487
+ /** The interview matrix: guide questions × active actors with answer cells. */
4488
+ async getBrainActorMatrix(areaId) {
4489
+ return this.get(`/brain/actors/matrix?area=${encodeURIComponent(areaId)}`);
4490
+ }
4491
+ /** Trigger the platform's answer extraction (one actor, or all active). */
4492
+ async extractBrainActorAnswers(input) {
4493
+ return this.post("/brain/actors/extract", input);
4494
+ }
4495
+ /**
4496
+ * Write one interview-matrix cell directly. The cell is marked
4497
+ * capturedVia "dcli" and the platform's extraction never overwrites it.
4498
+ */
4499
+ async setBrainActorAnswer(input) {
4500
+ return this.post("/brain/actors/answers", input);
4501
+ }
4502
+ /** Readiness scores: dimensions × active actors with full cells. */
4503
+ async getBrainActorScores(areaId) {
4504
+ return this.get(`/brain/actors/scores?area=${encodeURIComponent(areaId)}`);
4505
+ }
4506
+ /** Trigger the platform's readiness scoring (one actor, or all active). */
4507
+ async scoreBrainActors(input) {
4508
+ return this.post("/brain/actors/score", input);
4509
+ }
4510
+ /**
4511
+ * Write one readiness band directly (rationale required). The row is marked
4512
+ * capturedVia "dcli" and the platform's scoring never overwrites it.
4513
+ */
4514
+ async setBrainActorScore(input) {
4515
+ return this.post("/brain/actors/scores", input);
4516
+ }
4517
+ /** Scope a source to an actor (actorId null returns it to area level). */
4518
+ async scopeBrainSource(sourceId, actorId) {
4519
+ return this.patch(`/brain/sources/${encodeURIComponent(sourceId)}/actor`, { actorId });
4520
+ }
4487
4521
  /** Entities with an active customer role and no investor/partner/producer role. */
4488
4522
  async adminCustomersOnly() {
4489
4523
  return this.get("/admin/customers-only");
@@ -5110,7 +5144,7 @@ var import_promises4 = require("node:readline/promises");
5110
5144
  // package.json
5111
5145
  var package_default = {
5112
5146
  name: "@dayofweek/dcli",
5113
- version: "1.8.0",
5147
+ version: "1.9.1",
5114
5148
  description: "CLI for the Day of Week AgTech platform \u2014 read data and submit proposals for review",
5115
5149
  license: "MIT",
5116
5150
  type: "module",
@@ -5401,10 +5435,25 @@ brainSource.command("get <uri>").description("Read source metadata and derived t
5401
5435
  if (source.areaId !== parsed.areaId) throw new Error("Server returned a mismatched area");
5402
5436
  output(source);
5403
5437
  });
5404
- brainSource.command("upload").description("Upload an original file or meeting recording").requiredOption("--area <areaId>", "Destination area").requiredOption("--file <path>", "File to upload").option("--mime <mimeType>", "MIME type; inferred from extension when omitted").option("--meeting", "Mark this source as a recorded meeting").option("--consent-ack", "Confirm recorded participants were informed and consented").action(async (opts) => {
5438
+ brainSource.command("upload").description("Upload an original file or meeting recording").requiredOption("--area <areaId>", "Destination area").requiredOption("--file <path>", "File to upload").option("--mime <mimeType>", "MIME type; inferred from extension when omitted").option("--meeting", "Mark this source as a recorded meeting").option("--consent-ack", "Confirm recorded participants were informed and consented").option("--as-source", "Store an HTML document as a raw source instead of publishing it as a Page").action(async (opts) => {
5405
5439
  if (opts.meeting && !opts.consentAck) {
5406
5440
  throw new Error("--consent-ack is required: you are attesting that recorded participants were informed and consented");
5407
5441
  }
5442
+ if (!opts.asSource) {
5443
+ const looksHtmlName = /\.html?$/i.test(opts.file);
5444
+ let looksHtmlContent = false;
5445
+ try {
5446
+ const head = (0, import_node_fs8.readFileSync)(opts.file, "utf8").slice(0, 512);
5447
+ looksHtmlContent = /^\s*(<!doctype html|<html[\s>])/i.test(head);
5448
+ } catch {
5449
+ }
5450
+ if (looksHtmlName || looksHtmlContent) {
5451
+ throw new Error(
5452
+ `This looks like a Page (a full HTML document). Pages live in the area's Pages tab and are published with:
5453
+ dcli brain share --area <areaId> --title "\u2026" --file ` + opts.file + "\nPass --as-source only if you really want the raw HTML stored as a source file."
5454
+ );
5455
+ }
5456
+ }
5408
5457
  output(await getClient().uploadBrainSource({
5409
5458
  areaId: opts.area,
5410
5459
  path: opts.file,
@@ -5441,6 +5490,48 @@ brainActors.command("add").description("Add an actor to an area (idempotent on n
5441
5490
  description: opts.description
5442
5491
  }));
5443
5492
  });
5493
+ brainActors.command("matrix").description("The interview matrix: guide questions \xD7 active actors").requiredOption("--area <areaId>", "Area id (from `brain list`)").action(async (opts) => {
5494
+ output(await getClient().getBrainActorMatrix(opts.area));
5495
+ });
5496
+ brainActors.command("extract").description("Trigger the platform's answer extraction (all active actors, or one)").requiredOption("--area <areaId>", "Area id (from `brain list`)").option("--actor <actorId>", "Only this actor").action(async (opts) => {
5497
+ output(await getClient().extractBrainActorAnswers({ areaId: opts.area, actorId: opts.actor }));
5498
+ });
5499
+ brainActors.command("answer").description("Write one interview-matrix cell directly (marked capturedVia dcli, authoritative)").requiredOption("--actor <actorId>", "Actor id (from `brain actors list`)").requiredOption("--question <questionId>", "Question id (from `brain actors matrix`)").requiredOption("--answer <text>", "The answer; cite the source material in the text").option("--status <status>", "answered | partial | unknown", "answered").action(async (opts) => {
5500
+ if (!["answered", "partial", "unknown"].includes(opts.status)) {
5501
+ throw new Error(`--status must be answered, partial or unknown, got "${opts.status}"`);
5502
+ }
5503
+ output(await getClient().setBrainActorAnswer({
5504
+ actorId: opts.actor,
5505
+ questionId: opts.question,
5506
+ answer: opts.answer,
5507
+ status: opts.status
5508
+ }));
5509
+ });
5510
+ brainActors.command("scores").description("Readiness scores: dimensions \xD7 active actors with full cells").requiredOption("--area <areaId>", "Area id (from `brain list`)").action(async (opts) => {
5511
+ output(await getClient().getBrainActorScores(opts.area));
5512
+ });
5513
+ brainActors.command("score").description("Trigger the platform's readiness scoring (all active actors, or one)").requiredOption("--area <areaId>", "Area id (from `brain list`)").option("--actor <actorId>", "Only this actor").action(async (opts) => {
5514
+ output(await getClient().scoreBrainActors({ areaId: opts.area, actorId: opts.actor }));
5515
+ });
5516
+ brainActors.command("set-score").description("Write one readiness band directly (marked capturedVia dcli, authoritative)").requiredOption("--actor <actorId>", "Actor id (from `brain actors list`)").requiredOption("--dimension <key>", "Dimension key (from `brain actors scores`)").requiredOption("--band <band>", "red | orange | green").requiredOption("--rationale <text>", "Grounds for the band \u2014 required").option("--score <number>", "0..1 numeric backing (default derived from band)", parseFloat).option("--gaps <items...>", "Identified gaps").action(async (opts) => {
5517
+ if (!["red", "orange", "green"].includes(opts.band)) {
5518
+ throw new Error(`--band must be red, orange or green, got "${opts.band}"`);
5519
+ }
5520
+ output(await getClient().setBrainActorScore({
5521
+ actorId: opts.actor,
5522
+ dimensionKey: opts.dimension,
5523
+ band: opts.band,
5524
+ score: opts.score,
5525
+ rationale: opts.rationale,
5526
+ gaps: opts.gaps
5527
+ }));
5528
+ });
5529
+ brainSource.command("scope <sourceId>").description("Scope a source to an actor (feeds the readiness tables)").option("--actor <actorId>", "Actor id (from `brain actors list`)").option("--clear", "Return the source to area level").action(async (sourceId, opts) => {
5530
+ if (Boolean(opts.actor) === Boolean(opts.clear)) {
5531
+ throw new Error("Pass exactly one of --actor <actorId> or --clear");
5532
+ }
5533
+ output(await getClient().scopeBrainSource(sourceId, opts.actor ?? null));
5534
+ });
5444
5535
  auth.command("devices").description("List your agent tokens").action(async () => {
5445
5536
  const client = getClient();
5446
5537
  const devices = await client.listDevices();
package/dist/client.d.ts CHANGED
@@ -213,6 +213,44 @@ export declare class DayOfWeekClient {
213
213
  role?: string;
214
214
  description?: string;
215
215
  }): Promise<any>;
216
+ /** The interview matrix: guide questions × active actors with answer cells. */
217
+ getBrainActorMatrix(areaId: string): Promise<any>;
218
+ /** Trigger the platform's answer extraction (one actor, or all active). */
219
+ extractBrainActorAnswers(input: {
220
+ areaId: string;
221
+ actorId?: string;
222
+ }): Promise<any>;
223
+ /**
224
+ * Write one interview-matrix cell directly. The cell is marked
225
+ * capturedVia "dcli" and the platform's extraction never overwrites it.
226
+ */
227
+ setBrainActorAnswer(input: {
228
+ actorId: string;
229
+ questionId: string;
230
+ answer: string;
231
+ status?: "answered" | "partial" | "unknown";
232
+ }): Promise<any>;
233
+ /** Readiness scores: dimensions × active actors with full cells. */
234
+ getBrainActorScores(areaId: string): Promise<any>;
235
+ /** Trigger the platform's readiness scoring (one actor, or all active). */
236
+ scoreBrainActors(input: {
237
+ areaId: string;
238
+ actorId?: string;
239
+ }): Promise<any>;
240
+ /**
241
+ * Write one readiness band directly (rationale required). The row is marked
242
+ * capturedVia "dcli" and the platform's scoring never overwrites it.
243
+ */
244
+ setBrainActorScore(input: {
245
+ actorId: string;
246
+ dimensionKey: string;
247
+ band: "red" | "orange" | "green";
248
+ score?: number;
249
+ rationale: string;
250
+ gaps?: string[];
251
+ }): Promise<any>;
252
+ /** Scope a source to an actor (actorId null returns it to area level). */
253
+ scopeBrainSource(sourceId: string, actorId: string | null): Promise<any>;
216
254
  /** Entities with an active customer role and no investor/partner/producer role. */
217
255
  adminCustomersOnly(): Promise<any>;
218
256
  /** Tips mailed to press@mail.dayofweek.com, read by the press-scan skill. */
package/dist/client.js CHANGED
@@ -344,6 +344,40 @@ export class DayOfWeekClient {
344
344
  async createBrainActor(input) {
345
345
  return this.post("/brain/actors", input);
346
346
  }
347
+ /** The interview matrix: guide questions × active actors with answer cells. */
348
+ async getBrainActorMatrix(areaId) {
349
+ return this.get(`/brain/actors/matrix?area=${encodeURIComponent(areaId)}`);
350
+ }
351
+ /** Trigger the platform's answer extraction (one actor, or all active). */
352
+ async extractBrainActorAnswers(input) {
353
+ return this.post("/brain/actors/extract", input);
354
+ }
355
+ /**
356
+ * Write one interview-matrix cell directly. The cell is marked
357
+ * capturedVia "dcli" and the platform's extraction never overwrites it.
358
+ */
359
+ async setBrainActorAnswer(input) {
360
+ return this.post("/brain/actors/answers", input);
361
+ }
362
+ /** Readiness scores: dimensions × active actors with full cells. */
363
+ async getBrainActorScores(areaId) {
364
+ return this.get(`/brain/actors/scores?area=${encodeURIComponent(areaId)}`);
365
+ }
366
+ /** Trigger the platform's readiness scoring (one actor, or all active). */
367
+ async scoreBrainActors(input) {
368
+ return this.post("/brain/actors/score", input);
369
+ }
370
+ /**
371
+ * Write one readiness band directly (rationale required). The row is marked
372
+ * capturedVia "dcli" and the platform's scoring never overwrites it.
373
+ */
374
+ async setBrainActorScore(input) {
375
+ return this.post("/brain/actors/scores", input);
376
+ }
377
+ /** Scope a source to an actor (actorId null returns it to area level). */
378
+ async scopeBrainSource(sourceId, actorId) {
379
+ return this.patch(`/brain/sources/${encodeURIComponent(sourceId)}/actor`, { actorId });
380
+ }
347
381
  /** Entities with an active customer role and no investor/partner/producer role. */
348
382
  async adminCustomersOnly() {
349
383
  return this.get("/admin/customers-only");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dayofweek/dcli",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "CLI for the Day of Week AgTech platform \u2014 read data and submit proposals for review",
5
5
  "license": "MIT",
6
6
  "type": "module",