@jskit-ai/agent-docs 0.1.379 → 0.1.381
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/guide/agent/app-extras/assistant-conversation.md +3 -1
- package/guide/agent/app-extras/assistant.md +143 -20
- package/guide/agent/app-setup/material-3-migration.md +2 -1
- package/guide/agent/framework/material-3.md +2 -0
- package/guide/agent/framework/test-pass.md +3 -2
- package/guide/agent/framework/typed-features.md +16 -7
- package/package.json +1 -1
- package/patterns/minimal-foundation/example/package.json +1 -1
- package/patterns/shell-foundation/example/package.json +2 -2
- package/reference/autogen/PATTERN_INDEX.md +30 -19
- package/reference/autogen/packages/assistant-core.md +71 -4
- package/reference/autogen/packages/assistant-runtime.md +9 -1
- package/reference/autogen/packages/shell-web.md +13 -0
- package/reference/autogen/tooling/jskit-catalog.md +13 -2
- package/skills/jskit/references/material-3.md +2 -0
- package/skills/jskit/references/pattern-index.md +30 -19
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +1 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +2 -2
- package/skills/jskit/references/patterns/assistant/model-sized-results/PATTERN.md +147 -0
- package/skills/jskit/references/patterns/assistant/model-sized-results/example/packages/inbox/src/server/inbox.js +37 -0
- package/skills/jskit/references/patterns/assistant/model-sized-results/example/packages/inbox/src/server/inboxActions.js +90 -0
- package/skills/jskit/references/patterns/assistant/model-sized-results/example/packages/inbox/src/server/types.js +21 -0
- package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
- package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +1 -1
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +2 -2
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +3 -3
- package/skills/jskit/references/test-pass.md +3 -2
- package/skills/jskit/references/typed-features.md +16 -7
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createSchema } from "json-rest-schema";
|
|
2
|
+
|
|
3
|
+
const ACTION_READ_THREAD = "inbox.threads.read";
|
|
4
|
+
const ACTION_READ_MESSAGE_TEXT = "inbox.messages.read_text";
|
|
5
|
+
// How much of each email's text a conversation read gives the model. The rest of a longer email is read on with
|
|
6
|
+
// ACTION_READ_MESSAGE_TEXT, so the longest conversation's first parts fit the assistant's result limit.
|
|
7
|
+
const EMAIL_TEXT_PART = 2000;
|
|
8
|
+
|
|
9
|
+
/** The fields every inbox query shares, spread first into each definition. */
|
|
10
|
+
const INBOX_QUERY = Object.freeze({
|
|
11
|
+
version: 1,
|
|
12
|
+
kind: "query",
|
|
13
|
+
channels: ["api", "automation"],
|
|
14
|
+
surfaces: ["app"]
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const INBOX_READ = Object.freeze({ require: "all", permissions: ["inbox.read"] });
|
|
18
|
+
|
|
19
|
+
// An email's text is never trimmed: a part may start or end with a space, and a trimmed start would move every offset.
|
|
20
|
+
const threadMessage = createSchema({
|
|
21
|
+
id: { type: "string", required: true },
|
|
22
|
+
fromName: { type: "string", required: true },
|
|
23
|
+
receivedAt: { type: "string", required: true },
|
|
24
|
+
bodyText: { type: "string", noTrim: true, required: true }
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const threadInput = Object.freeze({ schema: createSchema({ threadId: { type: "string", required: true } }) });
|
|
28
|
+
const threadOutput = Object.freeze({
|
|
29
|
+
schema: createSchema({
|
|
30
|
+
id: { type: "string", required: true },
|
|
31
|
+
subject: { type: "string", required: true },
|
|
32
|
+
messages: { type: "array", required: true, items: threadMessage }
|
|
33
|
+
}),
|
|
34
|
+
mode: "replace"
|
|
35
|
+
});
|
|
36
|
+
const messageTextInput = Object.freeze({
|
|
37
|
+
schema: createSchema({
|
|
38
|
+
messageId: { type: "string", required: true },
|
|
39
|
+
offset: { type: "integer", min: 0, defaultTo: 0 }
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
const messageTextOutput = Object.freeze({
|
|
43
|
+
schema: createSchema({
|
|
44
|
+
messageId: { type: "string", required: true },
|
|
45
|
+
text: { type: "string", noTrim: true, required: true },
|
|
46
|
+
offset: { type: "integer", required: true },
|
|
47
|
+
nextOffset: { type: "integer", nullable: true, required: true },
|
|
48
|
+
total: { type: "integer", required: true }
|
|
49
|
+
}),
|
|
50
|
+
mode: "replace"
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/** @param {{ inbox: import("./types.js").Inbox }} dependencies */
|
|
54
|
+
function createInboxActions({ inbox }) {
|
|
55
|
+
return Object.freeze([
|
|
56
|
+
Object.freeze({
|
|
57
|
+
...INBOX_QUERY,
|
|
58
|
+
id: ACTION_READ_THREAD,
|
|
59
|
+
input: threadInput,
|
|
60
|
+
output: threadOutput,
|
|
61
|
+
permission: INBOX_READ,
|
|
62
|
+
extensions: {
|
|
63
|
+
assistant: {
|
|
64
|
+
description: "Read one inbox conversation: its subject and each email's sender, date and text.",
|
|
65
|
+
longText: {
|
|
66
|
+
"messages[].bodyText": {
|
|
67
|
+
partLength: EMAIL_TEXT_PART,
|
|
68
|
+
readAction: ACTION_READ_MESSAGE_TEXT,
|
|
69
|
+
input: (message) => ({ messageId: message.id })
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
execute: (input, context) => inbox.readThread(input, { context })
|
|
75
|
+
}),
|
|
76
|
+
Object.freeze({
|
|
77
|
+
...INBOX_QUERY,
|
|
78
|
+
id: ACTION_READ_MESSAGE_TEXT,
|
|
79
|
+
input: messageTextInput,
|
|
80
|
+
output: messageTextOutput,
|
|
81
|
+
permission: INBOX_READ,
|
|
82
|
+
extensions: {
|
|
83
|
+
assistant: { description: "Read one email's text from an offset, such as the rest of an email a conversation read gave in part." }
|
|
84
|
+
},
|
|
85
|
+
execute: (input, context) => inbox.readMessageText(input, { context })
|
|
86
|
+
})
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { ACTION_READ_MESSAGE_TEXT, ACTION_READ_THREAD, createInboxActions };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} InboxMessage
|
|
3
|
+
* @property {string} id
|
|
4
|
+
* @property {string} fromName
|
|
5
|
+
* @property {string} receivedAt
|
|
6
|
+
* @property {string} bodyText The email's plain text, as stored.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} InboxMessages
|
|
11
|
+
* @property {(threadId: string, options: { context: object }) => Promise<{ id: string, subject: string, messages: InboxMessage[] }>} readThread
|
|
12
|
+
* @property {(messageId: string, options: { context: object }) => Promise<InboxMessage>} readMessage
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} Inbox
|
|
17
|
+
* @property {(input: { threadId: string }, options: { context: object }) => Promise<object>} readThread
|
|
18
|
+
* @property {(input: { messageId: string, offset: number }, options: { context: object }) => Promise<object>} readMessageText
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export {};
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"./shared": "./src/shared/index.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@jskit-ai/crud-core": "0.2.
|
|
13
|
+
"@jskit-ai/crud-core": "0.2.66",
|
|
14
14
|
"@jskit-ai/resource-crud-core": "0.1.231",
|
|
15
|
-
"@jskit-ai/users-core": "0.2.
|
|
15
|
+
"@jskit-ai/users-core": "0.2.77"
|
|
16
16
|
},
|
|
17
17
|
"jskit": {
|
|
18
18
|
"kind": "runtime",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"./shared": "./src/shared/index.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@jskit-ai/crud-core": "0.2.
|
|
13
|
+
"@jskit-ai/crud-core": "0.2.66",
|
|
14
14
|
"@jskit-ai/resource-crud-core": "0.1.231",
|
|
15
|
-
"@jskit-ai/users-core": "0.2.
|
|
16
|
-
"@jskit-ai/workspaces-core": "0.2.
|
|
15
|
+
"@jskit-ai/users-core": "0.2.77",
|
|
16
|
+
"@jskit-ai/workspaces-core": "0.2.77"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@jskit-ai/kernel": "0.2.38",
|
|
@@ -195,8 +195,9 @@ The rules it applies are in [Typed features](typed-features.md),
|
|
|
195
195
|
- A file imports what it needs at its top level, so loading counts against the
|
|
196
196
|
file, not a test's time limit.
|
|
197
197
|
- The bounds stay: `jskit test`'s 10 minutes a file and 45 a run, its 10
|
|
198
|
-
seconds a file's process may live on after its last test
|
|
199
|
-
|
|
198
|
+
seconds a file's process may live on after its last test and `after`
|
|
199
|
+
hooks, and its `after` hooks after its last test (the linger bound, which
|
|
200
|
+
names what a test left open, or says the file was busy), and
|
|
200
201
|
`browserTestConfig()`'s `actionTimeout`, `navigationTimeout` and
|
|
201
202
|
`globalTimeout`. A bound in
|
|
202
203
|
`test-time-bounds.json` rises only with a measurement of the work's real
|
|
@@ -1095,10 +1095,16 @@ the last run's largest app server reached.**
|
|
|
1095
1095
|
one file at a time, an 8-thread machine four, and a container or slice whose
|
|
1096
1096
|
cgroup `cpu.max` quota gives it 3 CPUs of a 16-thread machine one
|
|
1097
1097
|
(`availableCpus()`).
|
|
1098
|
-
- `jskit test` (from `@jskit-ai/jskit-catalog`)
|
|
1099
|
-
|
|
1098
|
+
- `jskit test` (from `@jskit-ai/jskit-catalog`) takes `node --test`'s
|
|
1099
|
+
arguments and sets `--test-concurrency` to the budget.
|
|
1100
1100
|
`testConcurrency()` from `@jskit-ai/jskit-catalog/test-budget` returns the
|
|
1101
1101
|
same number for a config.
|
|
1102
|
+
- `jskit test` starts the files whose last run took longest first, from the
|
|
1103
|
+
times it records, and a file with no recorded time before them all, so a
|
|
1104
|
+
long file never starts last and runs on alone; `node --test` itself starts
|
|
1105
|
+
them by name. With `--test-shard=<index>/<total>` it picks each shard's
|
|
1106
|
+
files by name, as `node --test` does, so a shard is the same files on every
|
|
1107
|
+
machine.
|
|
1102
1108
|
- A Node test file is named `<name>.test.js`, and a database test
|
|
1103
1109
|
`<name>.integration.test.js`: given no files, `jskit test` runs node's
|
|
1104
1110
|
default pattern, less the files under a `support/` or `fixtures/` folder or
|
|
@@ -1206,9 +1212,10 @@ the last run's largest app server reached.**
|
|
|
1206
1212
|
files still finish and report: look for what it leaves open (a server, child
|
|
1207
1213
|
process, timer or socket) or a test without a timeout. A file with its own
|
|
1208
1214
|
bound is stopped at twice that bound.
|
|
1209
|
-
- A file whose tests have all ended but whose
|
|
1210
|
-
seconds later (the linger bound, `lingerMs
|
|
1211
|
-
|
|
1215
|
+
- A file whose tests and top-level `after` hooks have all ended but whose
|
|
1216
|
+
process is still running 10 seconds later (the linger bound, `lingerMs`)
|
|
1217
|
+
is stopped too, and so is one whose `after` hooks still run 10 seconds
|
|
1218
|
+
after its last test; each fails the run by name with what its process still
|
|
1212
1219
|
holds open, from `process.getActiveResourcesInfo()` read inside it, less
|
|
1213
1220
|
its own stdout and stderr, and stdin unless something reads it: `Timeout`
|
|
1214
1221
|
for an interval or timer, `TCPServerWrap` for a listening server,
|
|
@@ -1217,8 +1224,10 @@ the last run's largest app server reached.**
|
|
|
1217
1224
|
it in the test or an `after` hook. A file still busy past the bound with
|
|
1218
1225
|
nothing open fails the run as `busy, not held open`, with how long it
|
|
1219
1226
|
lived on, whether its stop met it late or it ended by itself first: finish
|
|
1220
|
-
the work it does after its last test
|
|
1221
|
-
|
|
1227
|
+
the work it does after its last test and `after` hooks within them. One
|
|
1228
|
+
stopped while its `after` hooks still ran waits on something that never
|
|
1229
|
+
ends, such as a server's open connections: end it. A file's process
|
|
1230
|
+
normally ends within moments of its `after` hooks, and the report says the
|
|
1222
1231
|
longest any took against the bound. Files marked `alone` or `network` get
|
|
1223
1232
|
the same bound. A suite whose measured cleanup needs longer sets `lingerMs` in
|
|
1224
1233
|
`test-time-bounds.json`, with the measurement in the commit that raises it.
|