@primusclaw/personal-agent-runtime 0.7.2 → 0.8.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/index.js +216 -86
- package/dist/types/claw/identity-lookup.d.ts +1 -1
- package/dist/types/claw/settings.d.ts +2 -1
- package/dist/types/config/aliases.d.ts +43 -0
- package/dist/types/config/env.d.ts +7 -1
- package/dist/types/config/index.d.ts +2 -1
- package/dist/types/config/secrets.d.ts +11 -1
- package/dist/types/config/settings.d.ts +1 -1
- package/dist/types/crypto/link-code.d.ts +1 -1
- package/dist/types/github/intent-reader.d.ts +3 -3
- package/dist/types/http/claw-events.d.ts +1 -1
- package/dist/types/sqlite/context.d.ts +1 -1
- package/dist/types/sqlite/database.d.ts +7 -1
- package/dist/types/sqlite/open.d.ts +2 -2
- package/dist/types/sqlite/store.d.ts +2 -2
- package/dist/types/worker/assemble.d.ts +28 -0
- package/dist/types/worker/build-info.d.ts +11 -0
- package/dist/types/worker/features-assistant.d.ts +50 -0
- package/dist/types/worker/features-base.d.ts +94 -0
- package/dist/types/worker/features-proactive.d.ts +25 -0
- package/dist/types/worker/features-remote.d.ts +13 -0
- package/dist/types/worker/features-review.d.ts +31 -0
- package/dist/types/worker/features-switches.d.ts +26 -0
- package/dist/types/worker/features-text.d.ts +38 -0
- package/dist/types/worker/features-turns.d.ts +18 -0
- package/dist/types/worker/features-w8.d.ts +20 -0
- package/dist/types/worker/features.d.ts +50 -0
- package/dist/types/worker/http.d.ts +23 -0
- package/dist/types/worker/plugins.d.ts +20 -0
- package/dist/types/worker/run-main.d.ts +3 -0
- package/dist/types/worker/runner.d.ts +36 -0
- package/dist/types/worker/startup-error.d.ts +7 -0
- package/dist/types/worker/surface-adapter.d.ts +87 -0
- package/dist/types/worker/timers.d.ts +14 -0
- package/dist/types/worker/worker-api.d.ts +70 -0
- package/dist/types/worker/worker-services.d.ts +29 -0
- package/dist/types/worker.d.ts +20 -0
- package/dist/worker.js +1684 -0
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -791,7 +791,7 @@ var HttpSessions = class {
|
|
|
791
791
|
name: cpHead2(session.text, 50),
|
|
792
792
|
mode: "claw",
|
|
793
793
|
config: sessionConfig(session),
|
|
794
|
-
...withMessage ? { message: await this.#textMessage(key2, session.text, acting) } : {}
|
|
794
|
+
...withMessage ? { message: await this.#textMessage(key2, session.text, acting, session.channel ?? "") } : {}
|
|
795
795
|
};
|
|
796
796
|
const model = session.model !== void 0 && session.model !== "" ? session.model : this.defaults.model;
|
|
797
797
|
const sent = model === "" ? body : { ...body, model };
|
|
@@ -830,7 +830,7 @@ var HttpSessions = class {
|
|
|
830
830
|
}
|
|
831
831
|
async sendMessage(key2, sessionId, text3, options = {}) {
|
|
832
832
|
const headers = modelKeyHeader(key2, options.modelKey);
|
|
833
|
-
const body = await this.#textMessage(key2, text3, options.acting ?? false);
|
|
833
|
+
const body = await this.#textMessage(key2, text3, options.acting ?? false, options.channel ?? "");
|
|
834
834
|
const path = `/v1/sessions/${segment(sessionId)}/messages`;
|
|
835
835
|
return messageIdOf(await this.http.json({ method: "POST", path, key: key2, body, headers }));
|
|
836
836
|
}
|
|
@@ -894,14 +894,14 @@ var HttpSessions = class {
|
|
|
894
894
|
/**
|
|
895
895
|
* A person's message, carrying the plugin id the way the web client does. A session that acts as a user gets the
|
|
896
896
|
* text alone: no plugin (its tools act with the requester's own key, and such a session reads a stranger's pull
|
|
897
|
-
* request) and nothing appended.
|
|
897
|
+
* request) and nothing appended. `channel`: the chat app's short name the appended headings carry.
|
|
898
898
|
*/
|
|
899
|
-
async #textMessage(key2, text3, acting) {
|
|
899
|
+
async #textMessage(key2, text3, acting, channel) {
|
|
900
900
|
if (acting) return { content: text3, messageType: "text" };
|
|
901
901
|
const { rule, pluginId } = this.defaults;
|
|
902
902
|
const ruleText2 = rule === null ? "" : await rule.text(key2);
|
|
903
903
|
return {
|
|
904
|
-
content: messageContent(text3, ruleText2, rule !== null),
|
|
904
|
+
content: messageContent(text3, ruleText2, rule !== null, channel),
|
|
905
905
|
messageType: "text",
|
|
906
906
|
...pluginId === null ? {} : { pluginId }
|
|
907
907
|
};
|
|
@@ -1024,20 +1024,22 @@ var HttpNotifications = class {
|
|
|
1024
1024
|
const path = "/v1/notification-subscriptions";
|
|
1025
1025
|
return rowsOf(await this.http.json({ method: "GET", path, key: key2 }), "the subscriptions");
|
|
1026
1026
|
}
|
|
1027
|
-
async create(key2, url, eventTypes = [], sources = []) {
|
|
1027
|
+
async create(key2, url, eventTypes = [], sources = [], surface = "") {
|
|
1028
1028
|
const body = {
|
|
1029
1029
|
url,
|
|
1030
1030
|
...eventTypes.length === 0 ? {} : { event_types: eventTypes },
|
|
1031
|
-
...sources.length === 0 ? {} : { sources }
|
|
1031
|
+
...sources.length === 0 ? {} : { sources },
|
|
1032
|
+
...surface === "" ? {} : { surface }
|
|
1032
1033
|
};
|
|
1033
1034
|
const path = "/v1/notification-subscriptions";
|
|
1034
1035
|
return dataOf(await this.http.json({ method: "POST", path, key: key2, body }), "a subscription");
|
|
1035
1036
|
}
|
|
1036
1037
|
async updateTypes(key2, subscriptionId, eventTypes, options = {}) {
|
|
1037
|
-
const { enable = false, sources = [] } = options;
|
|
1038
|
+
const { enable = false, sources = [], surface = "" } = options;
|
|
1038
1039
|
const body = {
|
|
1039
1040
|
event_types: eventTypes,
|
|
1040
1041
|
...sources.length === 0 ? {} : { sources },
|
|
1042
|
+
...surface === "" ? {} : { surface },
|
|
1041
1043
|
...enable ? { enabled: true } : {}
|
|
1042
1044
|
};
|
|
1043
1045
|
const path = `/v1/notification-subscriptions/${segment(subscriptionId)}`;
|
|
@@ -1818,8 +1820,87 @@ var HttpTokenExchange = class {
|
|
|
1818
1820
|
}
|
|
1819
1821
|
};
|
|
1820
1822
|
|
|
1823
|
+
// packages/runtime/src/config/aliases.ts
|
|
1824
|
+
import { own as own3, pyStrip as pyStrip4 } from "@primusclaw/personal-agent";
|
|
1825
|
+
var SETTING_PREFIX = "PA_";
|
|
1826
|
+
var LEGACY_SETTING_PREFIX = "TEAMS_";
|
|
1827
|
+
var ALIASED_SETTINGS = [
|
|
1828
|
+
"DB_PATH",
|
|
1829
|
+
"ENCRYPTION_KEYS",
|
|
1830
|
+
"CLAW_EVENTS_GONE",
|
|
1831
|
+
"ON_BEHALF_USERS",
|
|
1832
|
+
"OBSERVE_USERS",
|
|
1833
|
+
"DIRECT_CHAT",
|
|
1834
|
+
"DIRECT_CHAT_USERS",
|
|
1835
|
+
"ASSISTANT_UNDERSTANDING",
|
|
1836
|
+
"ASSISTANT_UNDERSTANDING_USERS",
|
|
1837
|
+
"GROUP_CONTEXT_MESSAGES",
|
|
1838
|
+
"GROUP_CONTEXT_HOURS",
|
|
1839
|
+
"GROUP_CONTEXT_CHARS",
|
|
1840
|
+
"GROUP_CONTEXT_GRANTED",
|
|
1841
|
+
"EXCHANGE_ENABLED",
|
|
1842
|
+
"EXCHANGE_CLIENT_ID",
|
|
1843
|
+
"EXCHANGE_CLIENT_SECRET",
|
|
1844
|
+
"EXCHANGE_TOKEN_URL",
|
|
1845
|
+
"EXCHANGE_BINDING_REQUEST_URL",
|
|
1846
|
+
"EXCHANGE_ISSUER",
|
|
1847
|
+
"EXCHANGE_AUDIENCE",
|
|
1848
|
+
"EXCHANGE_SCOPE",
|
|
1849
|
+
"EXCHANGE_FOR_CHAT",
|
|
1850
|
+
"GITHUB_REVIEW_ENABLED",
|
|
1851
|
+
"GITHUB_REVIEW_OWNERS",
|
|
1852
|
+
"REVIEW_INTENT_MODEL",
|
|
1853
|
+
"GITHUB_CREDENTIAL_URL",
|
|
1854
|
+
"GITHUB_CLIENT_ID",
|
|
1855
|
+
"USER_MESSAGE_LIMIT",
|
|
1856
|
+
"USER_MESSAGE_WINDOW_SECONDS",
|
|
1857
|
+
"USER_MAX_CONCURRENT_TASKS",
|
|
1858
|
+
"LINK_MAX_FAILURES_PER_USER",
|
|
1859
|
+
"LINK_MAX_FAILURES_GLOBAL",
|
|
1860
|
+
"LINK_ATTEMPT_WINDOW_SECONDS",
|
|
1861
|
+
"LIMIT_PR_REVIEW",
|
|
1862
|
+
"LIMIT_PR_MERGE",
|
|
1863
|
+
"LIMIT_APPROVAL",
|
|
1864
|
+
"LIMIT_REMOTE_AGENT"
|
|
1865
|
+
];
|
|
1866
|
+
var SETTING_ALIASES = new Map(
|
|
1867
|
+
ALIASED_SETTINGS.map((stem) => [SETTING_PREFIX + stem, LEGACY_SETTING_PREFIX + stem])
|
|
1868
|
+
);
|
|
1869
|
+
var NEUTRAL_OF = new Map([...SETTING_ALIASES].map(([neutral, old]) => [old, neutral]));
|
|
1870
|
+
var isSet = (env, name) => pyStrip4(own3(env, name) ?? "") !== "";
|
|
1871
|
+
function settingSource(env, name) {
|
|
1872
|
+
const neutral = NEUTRAL_OF.get(name) ?? name;
|
|
1873
|
+
const legacy = SETTING_ALIASES.get(neutral);
|
|
1874
|
+
if (legacy === void 0) return name;
|
|
1875
|
+
if (isSet(env, neutral)) return neutral;
|
|
1876
|
+
return own3(env, legacy) !== void 0 ? legacy : neutral;
|
|
1877
|
+
}
|
|
1878
|
+
function settingValue(env, name) {
|
|
1879
|
+
return own3(env, settingSource(env, name));
|
|
1880
|
+
}
|
|
1881
|
+
function legacySettings(env) {
|
|
1882
|
+
const out = [];
|
|
1883
|
+
for (const [neutral, legacy] of SETTING_ALIASES) {
|
|
1884
|
+
if (isSet(env, legacy)) out.push({ legacy, neutral, ignored: isSet(env, neutral) });
|
|
1885
|
+
}
|
|
1886
|
+
return out;
|
|
1887
|
+
}
|
|
1888
|
+
function warnLegacySettings(env, logger) {
|
|
1889
|
+
const used = legacySettings(env);
|
|
1890
|
+
const read2 = used.filter((s) => !s.ignored);
|
|
1891
|
+
if (read2.length > 0) {
|
|
1892
|
+
logger.warn(
|
|
1893
|
+
`deprecated setting names: ${read2.map((s) => `${s.legacy} (now ${s.neutral})`).join(", ")}; they still work, the ${SETTING_PREFIX} names take precedence`,
|
|
1894
|
+
{ settings: read2.map((s) => s.legacy).join(",") }
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
for (const s of used.filter((u) => u.ignored)) {
|
|
1898
|
+
logger.warn(`${s.legacy} is ignored: ${s.neutral} is set`, { setting: s.legacy });
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1821
1902
|
// packages/runtime/src/config/env.ts
|
|
1822
|
-
import { ConfigError, decimalBigInt,
|
|
1903
|
+
import { ConfigError, decimalBigInt, pyStrip as pyStrip5 } from "@primusclaw/personal-agent";
|
|
1823
1904
|
var ON = ["1", "true", "yes", "on"];
|
|
1824
1905
|
var OFF = ["0", "false", "no", "off"];
|
|
1825
1906
|
var EnvReader = class {
|
|
@@ -1827,18 +1908,22 @@ var EnvReader = class {
|
|
|
1827
1908
|
this.env = env;
|
|
1828
1909
|
}
|
|
1829
1910
|
env;
|
|
1911
|
+
/** The variable `name` is read from (the `PA_` or the `TEAMS_` name of a pair; any other name as it is). */
|
|
1912
|
+
source(name) {
|
|
1913
|
+
return settingSource(this.env, name);
|
|
1914
|
+
}
|
|
1830
1915
|
/** The raw value ("" unset). */
|
|
1831
1916
|
raw(name, fallback = "") {
|
|
1832
|
-
return
|
|
1917
|
+
return settingValue(this.env, name) ?? fallback;
|
|
1833
1918
|
}
|
|
1834
1919
|
/** The value without surrounding white space ("" unset). */
|
|
1835
1920
|
text(name, fallback = "") {
|
|
1836
|
-
return
|
|
1921
|
+
return pyStrip5(this.raw(name, fallback));
|
|
1837
1922
|
}
|
|
1838
1923
|
/** A value that must be set and not blank. */
|
|
1839
1924
|
required(name) {
|
|
1840
1925
|
const value = this.text(name);
|
|
1841
|
-
if (value === "") throw new ConfigError(`environment variable ${name} is required`);
|
|
1926
|
+
if (value === "") throw new ConfigError(`environment variable ${this.source(name)} is required`);
|
|
1842
1927
|
return value;
|
|
1843
1928
|
}
|
|
1844
1929
|
/** On or off; `fallback` when unset or empty; anything else stops the worker. */
|
|
@@ -1846,7 +1931,7 @@ var EnvReader = class {
|
|
|
1846
1931
|
const value = this.text(name).toLowerCase();
|
|
1847
1932
|
if (value === "") return fallback;
|
|
1848
1933
|
if (!ON.includes(value) && !OFF.includes(value)) {
|
|
1849
|
-
throw new ConfigError(`${name} must be on or off, not ${pyRepr(value)}`);
|
|
1934
|
+
throw new ConfigError(`${this.source(name)} must be on or off, not ${pyRepr(value)}`);
|
|
1850
1935
|
}
|
|
1851
1936
|
return ON.includes(value);
|
|
1852
1937
|
}
|
|
@@ -1860,17 +1945,17 @@ var EnvReader = class {
|
|
|
1860
1945
|
if (value === "") return fallback;
|
|
1861
1946
|
const number = decimalBigInt(value);
|
|
1862
1947
|
if (number === void 0 || number <= 0n) {
|
|
1863
|
-
throw new ConfigError(`${name} must be a positive whole number, not ${pyRepr(value)}`);
|
|
1948
|
+
throw new ConfigError(`${this.source(name)} must be a positive whole number, not ${pyRepr(value)}`);
|
|
1864
1949
|
}
|
|
1865
1950
|
return Number(number);
|
|
1866
1951
|
}
|
|
1867
1952
|
/** A whole number (Python's `int()` of the value: a sign, surrounding space and `_` between digits allowed). */
|
|
1868
1953
|
int(name, fallback) {
|
|
1869
|
-
const value =
|
|
1954
|
+
const value = pyStrip5(this.raw(name, fallback));
|
|
1870
1955
|
const match = new RegExp("^([+-]?)(\\p{Nd}+(?:_\\p{Nd}+)*)$", "u").exec(value);
|
|
1871
1956
|
const digits = match === null ? void 0 : decimalBigInt((match[2] ?? "").replaceAll("_", ""));
|
|
1872
1957
|
if (match === null || digits === void 0) {
|
|
1873
|
-
throw new ConfigError(`${name} must be a whole number, not ${pyRepr(value)}`);
|
|
1958
|
+
throw new ConfigError(`${this.source(name)} must be a whole number, not ${pyRepr(value)}`);
|
|
1874
1959
|
}
|
|
1875
1960
|
return Number(match[1] === "-" ? -digits : digits);
|
|
1876
1961
|
}
|
|
@@ -1880,7 +1965,7 @@ var EnvReader = class {
|
|
|
1880
1965
|
}
|
|
1881
1966
|
/** A comma separated list, blank entries dropped; `lower` lower-cases each entry. */
|
|
1882
1967
|
list(name, lower = false) {
|
|
1883
|
-
return this.raw(name).split(",").map((entry) =>
|
|
1968
|
+
return this.raw(name).split(",").map((entry) => pyStrip5(entry)).filter((entry) => entry !== "").map((entry) => lower ? entry.toLowerCase() : entry);
|
|
1884
1969
|
}
|
|
1885
1970
|
};
|
|
1886
1971
|
function pyRepr(value) {
|
|
@@ -1899,15 +1984,20 @@ import { readFileSync } from "node:fs";
|
|
|
1899
1984
|
import {
|
|
1900
1985
|
SECRETS_SOURCES,
|
|
1901
1986
|
SecretsUnavailable,
|
|
1902
|
-
pyStrip as
|
|
1987
|
+
pyStrip as pyStrip6
|
|
1903
1988
|
} from "@primusclaw/personal-agent";
|
|
1989
|
+
var SECRET_SETTING_NAMES = {
|
|
1990
|
+
TEAMS_ENCRYPTION_KEYS: "PA_ENCRYPTION_KEYS",
|
|
1991
|
+
TEAMS_EXCHANGE_CLIENT_SECRET: "PA_EXCHANGE_CLIENT_SECRET",
|
|
1992
|
+
FEEDBACK_GITHUB_APP_KEY: "FEEDBACK_GITHUB_KEY_FILE"
|
|
1993
|
+
};
|
|
1904
1994
|
var ENV_NAMES = {
|
|
1905
1995
|
TEAMS_ENCRYPTION_KEYS: "TEAMS_ENCRYPTION_KEYS",
|
|
1906
1996
|
TEAMS_EXCHANGE_CLIENT_SECRET: "TEAMS_EXCHANGE_CLIENT_SECRET",
|
|
1907
1997
|
FEEDBACK_GITHUB_APP_KEY: "FEEDBACK_GITHUB_KEY_FILE"
|
|
1908
1998
|
};
|
|
1909
1999
|
function secretsSourceOf(env) {
|
|
1910
|
-
const value =
|
|
2000
|
+
const value = pyStrip6(env["SECRETS_SOURCE"] ?? "").toLowerCase() || "env";
|
|
1911
2001
|
const known = SECRETS_SOURCES.find((name) => name === value);
|
|
1912
2002
|
if (known === void 0) {
|
|
1913
2003
|
throw new SecretsUnavailable(`SECRETS_SOURCE must be one of ${SECRETS_SOURCES.join(", ")}, not ${pyRepr(value)}`);
|
|
@@ -1918,7 +2008,7 @@ function wantedSecrets(env) {
|
|
|
1918
2008
|
const read2 = new EnvReader(env);
|
|
1919
2009
|
return [
|
|
1920
2010
|
"TEAMS_ENCRYPTION_KEYS",
|
|
1921
|
-
...read2.isOn("
|
|
2011
|
+
...read2.isOn("PA_EXCHANGE_ENABLED") ? ["TEAMS_EXCHANGE_CLIENT_SECRET"] : [],
|
|
1922
2012
|
...read2.text("FEEDBACK_GITHUB_APP_ID") !== "" && read2.text("FEEDBACK_GITHUB_INSTALLATION_ID") !== "" ? ["FEEDBACK_GITHUB_APP_KEY"] : []
|
|
1923
2013
|
];
|
|
1924
2014
|
}
|
|
@@ -1939,9 +2029,9 @@ var EnvSecretSource = class {
|
|
|
1939
2029
|
const values = /* @__PURE__ */ new Map();
|
|
1940
2030
|
const read2 = new EnvReader(this.env);
|
|
1941
2031
|
for (const name of names) {
|
|
1942
|
-
const variable =
|
|
2032
|
+
const variable = SECRET_SETTING_NAMES[name];
|
|
1943
2033
|
const value = read2.text(variable);
|
|
1944
|
-
if (value === "") throw new SecretsUnavailable(`environment variable ${variable} is required`);
|
|
2034
|
+
if (value === "") throw new SecretsUnavailable(`environment variable ${read2.source(variable)} is required`);
|
|
1945
2035
|
values.set(name, name === "FEEDBACK_GITHUB_APP_KEY" ? this.keyFile(value) : value);
|
|
1946
2036
|
}
|
|
1947
2037
|
return values;
|
|
@@ -1949,7 +2039,7 @@ var EnvSecretSource = class {
|
|
|
1949
2039
|
keyFile(path) {
|
|
1950
2040
|
let text3;
|
|
1951
2041
|
try {
|
|
1952
|
-
text3 =
|
|
2042
|
+
text3 = pyStrip6(this.readFile(path));
|
|
1953
2043
|
} catch {
|
|
1954
2044
|
throw new SecretsUnavailable(`FEEDBACK_GITHUB_KEY_FILE ${path} cannot be read`);
|
|
1955
2045
|
}
|
|
@@ -1966,6 +2056,7 @@ import {
|
|
|
1966
2056
|
DEFAULT_MESSAGE_WINDOW_SECONDS,
|
|
1967
2057
|
DEFAULT_GROUP_CONTEXT,
|
|
1968
2058
|
decimalBigInt as decimalBigInt2,
|
|
2059
|
+
LIMIT_ENV_PREFIX,
|
|
1969
2060
|
parseLimits
|
|
1970
2061
|
} from "@primusclaw/personal-agent";
|
|
1971
2062
|
var GITHUB_CLI_CLIENT_ID = "178c6fc778ccc68e1d6a";
|
|
@@ -1982,7 +2073,7 @@ function readSettings(env, secrets = /* @__PURE__ */ new Map()) {
|
|
|
1982
2073
|
throw new ConfigError2(`METRICS_PORT must differ from PORT (${String(listenPort)})`);
|
|
1983
2074
|
}
|
|
1984
2075
|
return {
|
|
1985
|
-
dbPath: read2.raw("
|
|
2076
|
+
dbPath: read2.raw("PA_DB_PATH", "/data/state.db"),
|
|
1986
2077
|
encryptionKeys: secret(read2, store, "TEAMS_ENCRYPTION_KEYS").split(",").map((k) => k.trim()).filter((k) => k !== ""),
|
|
1987
2078
|
clawApiUrl: withoutTrailingSlash(read2.required("CLAW_API_URL")),
|
|
1988
2079
|
safeApiUrl: withoutTrailingSlash(read2.required("SAFE_API_URL")),
|
|
@@ -2002,37 +2093,37 @@ function readSettings(env, secrets = /* @__PURE__ */ new Map()) {
|
|
|
2002
2093
|
},
|
|
2003
2094
|
githubReview: githubReviewSettings(read2, publicBaseUrl),
|
|
2004
2095
|
assistant: assistantSettings(read2),
|
|
2005
|
-
clawEventsGone: read2.isOn("
|
|
2096
|
+
clawEventsGone: read2.isOn("PA_CLAW_EVENTS_GONE"),
|
|
2006
2097
|
directChat: directChat(read2),
|
|
2007
|
-
onBehalfUsers: new Set(read2.list("
|
|
2008
|
-
observeUsers: new Set(read2.list("
|
|
2098
|
+
onBehalfUsers: new Set(read2.list("PA_ON_BEHALF_USERS")),
|
|
2099
|
+
observeUsers: new Set(read2.list("PA_OBSERVE_USERS", true)),
|
|
2009
2100
|
groupContext: groupContextSettings(read2),
|
|
2010
2101
|
sensitiveLimits: limitsOf(read2),
|
|
2011
2102
|
linkLimits: {
|
|
2012
|
-
perUser: read2.positiveInt("
|
|
2013
|
-
global: read2.positiveInt("
|
|
2014
|
-
windowSeconds: read2.positiveInt("
|
|
2103
|
+
perUser: read2.positiveInt("PA_LINK_MAX_FAILURES_PER_USER", 5),
|
|
2104
|
+
global: read2.positiveInt("PA_LINK_MAX_FAILURES_GLOBAL", 100),
|
|
2105
|
+
windowSeconds: read2.positiveInt("PA_LINK_ATTEMPT_WINDOW_SECONDS", 600)
|
|
2015
2106
|
},
|
|
2016
2107
|
userLimits: {
|
|
2017
|
-
messageLimit: read2.positiveInt("
|
|
2018
|
-
messageWindowSeconds: read2.positiveInt("
|
|
2019
|
-
maxConcurrentTasks: read2.positiveInt("
|
|
2108
|
+
messageLimit: read2.positiveInt("PA_USER_MESSAGE_LIMIT", DEFAULT_MESSAGE_LIMIT),
|
|
2109
|
+
messageWindowSeconds: read2.positiveInt("PA_USER_MESSAGE_WINDOW_SECONDS", DEFAULT_MESSAGE_WINDOW_SECONDS),
|
|
2110
|
+
maxConcurrentTasks: read2.positiveInt("PA_USER_MAX_CONCURRENT_TASKS", DEFAULT_MAX_CONCURRENT_TASKS)
|
|
2020
2111
|
},
|
|
2021
2112
|
secretsSource: store.source
|
|
2022
2113
|
};
|
|
2023
2114
|
}
|
|
2024
2115
|
function groupContextSettings(read2) {
|
|
2025
|
-
const messages = read2.int("
|
|
2116
|
+
const messages = read2.int("PA_GROUP_CONTEXT_MESSAGES", String(DEFAULT_GROUP_CONTEXT.messages));
|
|
2026
2117
|
if (messages < 0 || messages > MAX_GROUP_CONTEXT_MESSAGES) {
|
|
2027
2118
|
throw new ConfigError2(
|
|
2028
|
-
|
|
2119
|
+
`${read2.source("PA_GROUP_CONTEXT_MESSAGES")} must be between 0 and ${String(MAX_GROUP_CONTEXT_MESSAGES)}, not ${String(messages)}`
|
|
2029
2120
|
);
|
|
2030
2121
|
}
|
|
2031
2122
|
return {
|
|
2032
2123
|
messages,
|
|
2033
|
-
maxAgeSeconds: read2.positiveInt("
|
|
2034
|
-
messageChars: read2.positiveInt("
|
|
2035
|
-
granted: read2.raw("
|
|
2124
|
+
maxAgeSeconds: read2.positiveInt("PA_GROUP_CONTEXT_HOURS", DEFAULT_GROUP_CONTEXT.maxAgeSeconds / 3600) * 3600,
|
|
2125
|
+
messageChars: read2.positiveInt("PA_GROUP_CONTEXT_CHARS", DEFAULT_GROUP_CONTEXT.messageChars),
|
|
2126
|
+
granted: read2.raw("PA_GROUP_CONTEXT_GRANTED") === "1"
|
|
2036
2127
|
};
|
|
2037
2128
|
}
|
|
2038
2129
|
function secret(read2, store, name) {
|
|
@@ -2041,41 +2132,43 @@ function secret(read2, store, name) {
|
|
|
2041
2132
|
if (store.source === "keyvault") {
|
|
2042
2133
|
throw new ConfigError2(`SECRETS_SOURCE=keyvault but ${name} was not read from the vault`);
|
|
2043
2134
|
}
|
|
2044
|
-
return read2.required(name);
|
|
2135
|
+
return read2.required(SECRET_SETTING_NAMES[name]);
|
|
2045
2136
|
}
|
|
2046
2137
|
function exchangeSettings(read2, store, publicBaseUrl) {
|
|
2047
|
-
const enabled = read2.isOn("
|
|
2048
|
-
const forChat = read2.isOn("
|
|
2049
|
-
if (read2.isOn("
|
|
2050
|
-
throw new ConfigError2("
|
|
2138
|
+
const enabled = read2.isOn("PA_EXCHANGE_ENABLED");
|
|
2139
|
+
const forChat = read2.isOn("PA_EXCHANGE_FOR_CHAT");
|
|
2140
|
+
if (read2.isOn("PA_GITHUB_REVIEW_ENABLED") && !enabled) {
|
|
2141
|
+
throw new ConfigError2(`${read2.source("PA_GITHUB_REVIEW_ENABLED")} needs ${read2.source("PA_EXCHANGE_ENABLED")}`);
|
|
2142
|
+
}
|
|
2143
|
+
if (forChat && !enabled) {
|
|
2144
|
+
throw new ConfigError2(`${read2.source("PA_EXCHANGE_FOR_CHAT")} needs ${read2.source("PA_EXCHANGE_ENABLED")}`);
|
|
2051
2145
|
}
|
|
2052
|
-
if (forChat && !enabled) throw new ConfigError2("TEAMS_EXCHANGE_FOR_CHAT needs TEAMS_EXCHANGE_ENABLED");
|
|
2053
2146
|
return {
|
|
2054
2147
|
enabled,
|
|
2055
|
-
tokenUrl: enabled ? read2.raw("
|
|
2056
|
-
clientId: enabled ? read2.required("
|
|
2148
|
+
tokenUrl: enabled ? read2.raw("PA_EXCHANGE_TOKEN_URL", `${publicBaseUrl}/oauth/token`) : "",
|
|
2149
|
+
clientId: enabled ? read2.required("PA_EXCHANGE_CLIENT_ID") : "",
|
|
2057
2150
|
clientSecret: enabled ? secret(read2, store, "TEAMS_EXCHANGE_CLIENT_SECRET") : "",
|
|
2058
|
-
issuer: read2.raw("
|
|
2059
|
-
audience: read2.raw("
|
|
2060
|
-
scope: read2.raw("
|
|
2061
|
-
bindingRequestUrl: enabled ? read2.raw("
|
|
2151
|
+
issuer: read2.raw("PA_EXCHANGE_ISSUER", "teams.microsoft.com"),
|
|
2152
|
+
audience: read2.raw("PA_EXCHANGE_AUDIENCE", "claw-api"),
|
|
2153
|
+
scope: read2.raw("PA_EXCHANGE_SCOPE", "claw.api"),
|
|
2154
|
+
bindingRequestUrl: enabled ? read2.raw("PA_EXCHANGE_BINDING_REQUEST_URL", `${publicBaseUrl}/oauth/binding-requests`) : "",
|
|
2062
2155
|
forChat
|
|
2063
2156
|
};
|
|
2064
2157
|
}
|
|
2065
2158
|
function githubReviewSettings(read2, publicBaseUrl) {
|
|
2066
|
-
const enabled = read2.isOn("
|
|
2067
|
-
const owners = read2.list("
|
|
2159
|
+
const enabled = read2.isOn("PA_GITHUB_REVIEW_ENABLED");
|
|
2160
|
+
const owners = read2.list("PA_GITHUB_REVIEW_OWNERS");
|
|
2068
2161
|
if (enabled && owners.length === 0) {
|
|
2069
2162
|
throw new ConfigError2(
|
|
2070
|
-
"
|
|
2163
|
+
`${read2.source("PA_GITHUB_REVIEW_ENABLED")} needs ${read2.source("PA_GITHUB_REVIEW_OWNERS")} (the GitHub owners whose pull requests are taken)`
|
|
2071
2164
|
);
|
|
2072
2165
|
}
|
|
2073
2166
|
return {
|
|
2074
2167
|
enabled,
|
|
2075
2168
|
owners,
|
|
2076
|
-
intentModel: enabled ? read2.text("
|
|
2077
|
-
credentialUrl: enabled ? withoutTrailingSlash(read2.raw("
|
|
2078
|
-
clientId: read2.text("
|
|
2169
|
+
intentModel: enabled ? read2.text("PA_REVIEW_INTENT_MODEL") || read2.text("CLAWY_MODEL") : "",
|
|
2170
|
+
credentialUrl: enabled ? withoutTrailingSlash(read2.raw("PA_GITHUB_CREDENTIAL_URL", `${publicBaseUrl}/oauth/external-credentials`)) : "",
|
|
2171
|
+
clientId: read2.text("PA_GITHUB_CLIENT_ID", GITHUB_CLI_CLIENT_ID) || GITHUB_CLI_CLIENT_ID
|
|
2079
2172
|
};
|
|
2080
2173
|
}
|
|
2081
2174
|
function assistantSettings(read2) {
|
|
@@ -2085,20 +2178,22 @@ function assistantSettings(read2) {
|
|
|
2085
2178
|
throw new ConfigError2(`ASSISTANT_REPLY_WINDOW_SECONDS must be a positive number of seconds, not ${pyRepr(window)}`);
|
|
2086
2179
|
}
|
|
2087
2180
|
const enabled = read2.isOn("ASSISTANT_ENABLED");
|
|
2088
|
-
const understanding = read2.switch("
|
|
2181
|
+
const understanding = read2.switch("PA_ASSISTANT_UNDERSTANDING", false);
|
|
2089
2182
|
const users = new Set(read2.list("ASSISTANT_USERS", true));
|
|
2090
|
-
const listed = new Set(read2.list("
|
|
2183
|
+
const listed = new Set(read2.list("PA_ASSISTANT_UNDERSTANDING_USERS", true));
|
|
2091
2184
|
const understandingUsers = understanding ? listed.size > 0 ? listed : users : /* @__PURE__ */ new Set();
|
|
2092
2185
|
if (understanding && understandingUsers.size === 0) {
|
|
2093
2186
|
throw new ConfigError2(
|
|
2094
|
-
"
|
|
2187
|
+
`${read2.source("PA_ASSISTANT_UNDERSTANDING")} is on but ${read2.source("PA_ASSISTANT_UNDERSTANDING_USERS")} names nobody (and ASSISTANT_USERS is empty)`
|
|
2095
2188
|
);
|
|
2096
2189
|
}
|
|
2097
2190
|
if (understandingUsers.size > 0 && !enabled) {
|
|
2098
|
-
throw new ConfigError2("
|
|
2191
|
+
throw new ConfigError2(`${read2.source("PA_ASSISTANT_UNDERSTANDING")} needs ASSISTANT_ENABLED`);
|
|
2099
2192
|
}
|
|
2100
2193
|
if (users.size > 0 && [...understandingUsers].some((u) => !users.has(u))) {
|
|
2101
|
-
throw new ConfigError2(
|
|
2194
|
+
throw new ConfigError2(
|
|
2195
|
+
`${read2.source("PA_ASSISTANT_UNDERSTANDING_USERS")} names people who are not in ASSISTANT_USERS`
|
|
2196
|
+
);
|
|
2102
2197
|
}
|
|
2103
2198
|
return {
|
|
2104
2199
|
enabled,
|
|
@@ -2109,13 +2204,16 @@ function assistantSettings(read2) {
|
|
|
2109
2204
|
}
|
|
2110
2205
|
function directChat(read2) {
|
|
2111
2206
|
return {
|
|
2112
|
-
enabled: read2.switch("
|
|
2113
|
-
users: new Set(read2.list("
|
|
2207
|
+
enabled: read2.switch("PA_DIRECT_CHAT", false),
|
|
2208
|
+
users: new Set(read2.list("PA_DIRECT_CHAT_USERS", true))
|
|
2114
2209
|
};
|
|
2115
2210
|
}
|
|
2116
2211
|
function limitsOf(read2) {
|
|
2117
2212
|
try {
|
|
2118
|
-
return parseLimits((name) => read2.raw(name)
|
|
2213
|
+
return parseLimits((name) => read2.raw(name), {
|
|
2214
|
+
prefix: LIMIT_ENV_PREFIX,
|
|
2215
|
+
source: (name) => read2.source(name)
|
|
2216
|
+
});
|
|
2119
2217
|
} catch (err5) {
|
|
2120
2218
|
if (err5 instanceof ConfigError2) throw err5;
|
|
2121
2219
|
throw new ConfigError2(err5 instanceof Error ? err5.message : String(err5));
|
|
@@ -2392,6 +2490,20 @@ var Database = class {
|
|
|
2392
2490
|
constructor(path) {
|
|
2393
2491
|
this.#db = new DatabaseSync(path, { timeout: 5e3 });
|
|
2394
2492
|
this.#db.exec("PRAGMA journal_mode=WAL");
|
|
2493
|
+
this.#db.exec("PRAGMA synchronous=NORMAL");
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* `write` with each commit synced to disk (`synchronous=FULL`): for what is acknowledged as kept before it is used. Inside an
|
|
2497
|
+
* open transaction SQLite refuses to change the setting, so there `write` just runs and its commit is the transaction's.
|
|
2498
|
+
*/
|
|
2499
|
+
durably(write) {
|
|
2500
|
+
if (this.#db.isTransaction) return write();
|
|
2501
|
+
this.#db.exec("PRAGMA synchronous=FULL");
|
|
2502
|
+
try {
|
|
2503
|
+
return write();
|
|
2504
|
+
} finally {
|
|
2505
|
+
this.#db.exec("PRAGMA synchronous=NORMAL");
|
|
2506
|
+
}
|
|
2395
2507
|
}
|
|
2396
2508
|
/** Several statements, no parameters (DDL). */
|
|
2397
2509
|
exec(sql) {
|
|
@@ -3774,8 +3886,10 @@ var ADDED_COLUMNS = [
|
|
|
3774
3886
|
[
|
|
3775
3887
|
["message_id", "TEXT NOT NULL DEFAULT ''"],
|
|
3776
3888
|
// '' = the channel never said the card's id
|
|
3777
|
-
["ask_json", "TEXT NOT NULL DEFAULT ''"]
|
|
3889
|
+
["ask_json", "TEXT NOT NULL DEFAULT ''"],
|
|
3778
3890
|
// '' = not a question a terminal asks
|
|
3891
|
+
["lang", "TEXT NOT NULL DEFAULT ''"]
|
|
3892
|
+
// the card's language; '' = shown before it was kept
|
|
3779
3893
|
]
|
|
3780
3894
|
],
|
|
3781
3895
|
[
|
|
@@ -4188,12 +4302,14 @@ var SqliteHeldEventRepository = class {
|
|
|
4188
4302
|
const { db } = this.ctx;
|
|
4189
4303
|
const now = this.ctx.now();
|
|
4190
4304
|
db.run("DELETE FROM held_events WHERE held_at < ?", now - HELD_TTL_SECONDS);
|
|
4191
|
-
db.
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4305
|
+
db.durably(
|
|
4306
|
+
() => db.run(
|
|
4307
|
+
"INSERT OR IGNORE INTO held_events (event_id, aad_id, event_json, held_at) VALUES (?, ?, ?, ?)",
|
|
4308
|
+
pyStr4(event["event_id"]),
|
|
4309
|
+
userId,
|
|
4310
|
+
pyJsonDumps(event),
|
|
4311
|
+
now
|
|
4312
|
+
)
|
|
4197
4313
|
);
|
|
4198
4314
|
db.run(
|
|
4199
4315
|
"DELETE FROM held_events WHERE aad_id = ? AND event_id NOT IN (SELECT event_id FROM held_events WHERE aad_id = ? ORDER BY held_at DESC, rowid DESC LIMIT ?)",
|
|
@@ -4268,7 +4384,7 @@ var SqliteRemoteSessionNameRepository = class {
|
|
|
4268
4384
|
);
|
|
4269
4385
|
}
|
|
4270
4386
|
};
|
|
4271
|
-
var PERMISSION_COLUMNS = "session_id, action_id, aad_id, tool, options_json, expires_at, state, message_id, ask_json";
|
|
4387
|
+
var PERMISSION_COLUMNS = "session_id, action_id, aad_id, tool, options_json, expires_at, state, message_id, ask_json, lang";
|
|
4272
4388
|
function permission(row) {
|
|
4273
4389
|
return {
|
|
4274
4390
|
sessionId: col.str(row, "session_id"),
|
|
@@ -4279,9 +4395,13 @@ function permission(row) {
|
|
|
4279
4395
|
expiresAt: col.num(row, "expires_at"),
|
|
4280
4396
|
state: col.str(row, "state"),
|
|
4281
4397
|
messageId: col.str(row, "message_id"),
|
|
4282
|
-
ask: askOf(col.str(row, "ask_json"))
|
|
4398
|
+
ask: askOf(col.str(row, "ask_json")),
|
|
4399
|
+
lang: langOf(col.str(row, "lang"))
|
|
4283
4400
|
};
|
|
4284
4401
|
}
|
|
4402
|
+
function langOf(text3) {
|
|
4403
|
+
return text3 === "zh" || text3 === "en" ? text3 : "";
|
|
4404
|
+
}
|
|
4285
4405
|
function askOf(text3) {
|
|
4286
4406
|
if (!text3) return null;
|
|
4287
4407
|
try {
|
|
@@ -4300,7 +4420,7 @@ var SqliteRemotePermissionRepository = class {
|
|
|
4300
4420
|
const now = this.ctx.now();
|
|
4301
4421
|
this.ctx.db.run("DELETE FROM remote_permissions WHERE expires_at < ?", now - REMOTE_PERMISSION_KEEP_SECONDS);
|
|
4302
4422
|
return this.ctx.db.run(
|
|
4303
|
-
"INSERT OR IGNORE INTO remote_permissions (session_id, action_id, aad_id, tool, options_json, expires_at, created_at, ask_json) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
|
4423
|
+
"INSERT OR IGNORE INTO remote_permissions (session_id, action_id, aad_id, tool, options_json, expires_at, created_at, ask_json, lang) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
4304
4424
|
p.sessionId,
|
|
4305
4425
|
p.actionId,
|
|
4306
4426
|
p.userId,
|
|
@@ -4308,7 +4428,8 @@ var SqliteRemotePermissionRepository = class {
|
|
|
4308
4428
|
pyJsonDumps(p.options),
|
|
4309
4429
|
p.expiresAt,
|
|
4310
4430
|
now,
|
|
4311
|
-
p.ask ? JSON.stringify(p.ask) : ""
|
|
4431
|
+
p.ask ? JSON.stringify(p.ask) : "",
|
|
4432
|
+
p.lang ?? ""
|
|
4312
4433
|
) === 1;
|
|
4313
4434
|
}
|
|
4314
4435
|
getRemotePermission(sessionId, actionId) {
|
|
@@ -5474,9 +5595,9 @@ var GithubDeviceFlow = class {
|
|
|
5474
5595
|
|
|
5475
5596
|
// packages/runtime/src/github/intent-reader.ts
|
|
5476
5597
|
import {
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5598
|
+
answerPrompt,
|
|
5599
|
+
intentPrompt,
|
|
5600
|
+
modePrompt,
|
|
5480
5601
|
errorName as errorName6,
|
|
5481
5602
|
pyJsonDumps as pyJsonDumps2,
|
|
5482
5603
|
pyRstrip as pyRstrip4
|
|
@@ -5507,14 +5628,14 @@ var GatewayIntentReader = class {
|
|
|
5507
5628
|
options;
|
|
5508
5629
|
url;
|
|
5509
5630
|
fetchImpl;
|
|
5510
|
-
read(key2, text3, mentions) {
|
|
5511
|
-
return this.complete(key2,
|
|
5631
|
+
read(key2, text3, mentions, channel) {
|
|
5632
|
+
return this.complete(key2, intentPrompt(channel), { message: text3, mentions });
|
|
5512
5633
|
}
|
|
5513
|
-
readMode(key2, text3) {
|
|
5514
|
-
return this.complete(key2,
|
|
5634
|
+
readMode(key2, text3, channel) {
|
|
5635
|
+
return this.complete(key2, modePrompt(channel), { message: text3 });
|
|
5515
5636
|
}
|
|
5516
|
-
readAnswer(key2, text3, pending) {
|
|
5517
|
-
return this.complete(key2,
|
|
5637
|
+
readAnswer(key2, text3, pending, channel) {
|
|
5638
|
+
return this.complete(key2, answerPrompt(channel), { message: text3, waiting_for_this_person: pending });
|
|
5518
5639
|
}
|
|
5519
5640
|
async complete(key2, system, payload) {
|
|
5520
5641
|
const body = {
|
|
@@ -5796,7 +5917,7 @@ function feedbackSink(config, options) {
|
|
|
5796
5917
|
|
|
5797
5918
|
// packages/runtime/src/github/feedback-worker.ts
|
|
5798
5919
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
5799
|
-
import { pyStrip as
|
|
5920
|
+
import { pyStrip as pyStrip7 } from "@primusclaw/personal-agent";
|
|
5800
5921
|
function packageVersion(packageJson) {
|
|
5801
5922
|
try {
|
|
5802
5923
|
const parsed = JSON.parse(readFileSync3(packageJson, "utf8"));
|
|
@@ -5807,7 +5928,7 @@ function packageVersion(packageJson) {
|
|
|
5807
5928
|
}
|
|
5808
5929
|
}
|
|
5809
5930
|
function workerInfoFromEnv(env, worker) {
|
|
5810
|
-
const tag = (name) =>
|
|
5931
|
+
const tag = (name) => pyStrip7(env[name] ?? "");
|
|
5811
5932
|
return {
|
|
5812
5933
|
pluginId: worker.pluginId,
|
|
5813
5934
|
version: worker.version,
|
|
@@ -5882,6 +6003,7 @@ var ChatLog = class {
|
|
|
5882
6003
|
export {
|
|
5883
6004
|
ACCESS_TOKEN,
|
|
5884
6005
|
ALERTED,
|
|
6006
|
+
ALIASED_SETTINGS,
|
|
5885
6007
|
ASSISTANT_REPLY_WINDOW_SECONDS,
|
|
5886
6008
|
AppTokenSource,
|
|
5887
6009
|
BUSY_POLL_MS,
|
|
@@ -5917,6 +6039,7 @@ export {
|
|
|
5917
6039
|
IdentityCredentialClient,
|
|
5918
6040
|
InvalidToken,
|
|
5919
6041
|
LAG_WINDOW_MS,
|
|
6042
|
+
LEGACY_SETTING_PREFIX,
|
|
5920
6043
|
LINK_HASH_LABEL,
|
|
5921
6044
|
MAX_BODY_BYTES,
|
|
5922
6045
|
MAX_DEVICE_WAIT_SECONDS,
|
|
@@ -5929,6 +6052,9 @@ export {
|
|
|
5929
6052
|
PublicPullReader,
|
|
5930
6053
|
REFRESH_MARGIN_SECONDS,
|
|
5931
6054
|
REQUEST_MARGIN_SECONDS,
|
|
6055
|
+
SECRET_SETTING_NAMES,
|
|
6056
|
+
SETTING_ALIASES,
|
|
6057
|
+
SETTING_PREFIX,
|
|
5932
6058
|
SqliteStore,
|
|
5933
6059
|
StoreSecrets,
|
|
5934
6060
|
UNMATCHED_ROUTE,
|
|
@@ -5950,6 +6076,7 @@ export {
|
|
|
5950
6076
|
hashLinkCode,
|
|
5951
6077
|
healthzRoute,
|
|
5952
6078
|
json,
|
|
6079
|
+
legacySettings,
|
|
5953
6080
|
lineLogger,
|
|
5954
6081
|
linkHashKey,
|
|
5955
6082
|
linkRoute,
|
|
@@ -5965,6 +6092,8 @@ export {
|
|
|
5965
6092
|
round3,
|
|
5966
6093
|
ruleText,
|
|
5967
6094
|
secretsSourceOf,
|
|
6095
|
+
settingSource,
|
|
6096
|
+
settingValue,
|
|
5968
6097
|
sign,
|
|
5969
6098
|
sinceOccurred,
|
|
5970
6099
|
systemClock,
|
|
@@ -5973,6 +6102,7 @@ export {
|
|
|
5973
6102
|
urlsafeB64Decode,
|
|
5974
6103
|
urlsafeB64Encode,
|
|
5975
6104
|
wantedSecrets,
|
|
6105
|
+
warnLegacySettings,
|
|
5976
6106
|
withoutTrailingSlash,
|
|
5977
6107
|
workerInfoFromEnv
|
|
5978
6108
|
};
|
|
@@ -14,7 +14,7 @@ export interface IdentityLookupOptions {
|
|
|
14
14
|
/**
|
|
15
15
|
* Who a credential belongs to. A person's own key (`ak-...`) is asked of the platform's `/users/self` with the key itself
|
|
16
16
|
* (the Python worker's `safe.whoami`, `safe.safe_user` and `safe.user_id_of`, which read the same answer). An identity
|
|
17
|
-
* token exchanged for them (
|
|
17
|
+
* token exchanged for them (PA_EXCHANGE_FOR_CHAT) is asked of Claw's `/v1/me` with the token, when Claw's URL is
|
|
18
18
|
* given: the platform does not take such a token on its data routes, and Claw answers with the platform's id, name and
|
|
19
19
|
* email of the token's subject (it has no account type: ""). Any failure is no owner: an answer other than 200, a timeout
|
|
20
20
|
* or a broken connection, a body that is not JSON or not an object. The caller says so, or tries again later (the
|
|
@@ -21,10 +21,11 @@ export declare class HttpNotifications implements ClawNotificationsPort {
|
|
|
21
21
|
private readonly http;
|
|
22
22
|
constructor(http: ClawHttp);
|
|
23
23
|
list(key: ClawCredential): Promise<ClawSubscription[]>;
|
|
24
|
-
create(key: ClawCredential, url: string, eventTypes?: readonly string[], sources?: readonly string[]): Promise<ClawSubscription>;
|
|
24
|
+
create(key: ClawCredential, url: string, eventTypes?: readonly string[], sources?: readonly string[], surface?: string): Promise<ClawSubscription>;
|
|
25
25
|
updateTypes(key: ClawCredential, subscriptionId: string, eventTypes: readonly string[], options?: {
|
|
26
26
|
enable?: boolean;
|
|
27
27
|
sources?: readonly string[];
|
|
28
|
+
surface?: string;
|
|
28
29
|
}): Promise<ClawSubscription>;
|
|
29
30
|
delete(key: ClawCredential, subscriptionId: string): Promise<void>;
|
|
30
31
|
}
|